Manipulation of text by programs, scripts, etc.

learn more… | top users | synonyms

0
votes
5answers
45 views

Merge multiple lines in same file based on column 1

I'm still learning programming and I've tried many things but just cannot get the correct format. I have a tab delimited file with 17 columns and many (around 50.000) rows. The file is already sorted ...
1
vote
2answers
25 views

Split file into multiple files based on pattern [duplicate]

I have a large file that's a couple hundred lines long. This file is partitioned into many parts by a specific identifier, lets say 'ABC'. This line 'ABC' appears 6 times so I want 6 output files. I'm ...
3
votes
1answer
38 views

Replacing a & in XML correctly?

I want to replace a '&' with &amp; Except the following occurance of XML special characters. " &quot; ' &apos; < &lt; > &gt; & &amp; I tried the ...
0
votes
1answer
20 views

extract block of words from specific delimiter

I have a block of words like this, on a single line: Id item: VALUE nom: VALUE type: VALUE path: VALUE Id item: VALUE nom: VALUE type: VALUE path: VALUE Id item: VALUE nom: VALUE type: VALUE path: ...
5
votes
2answers
127 views

for loop over input lines

I have a file with a lot of lines like this /item/pubDate=Sun, 23 Feb 2014 00:55:04 +010 If I execute this echo "/item/pubDate=Sun, 23 Feb 2014 00:55:04 +010" | grep -Po "(?<=\=).*" Sun, 23 ...
-1
votes
1answer
18 views

retain unique values in txt file with counts

I have a text file with a single word in each line. I would like to convert this to a text file that only has each word appearing once, and also give the number of times that word appeared in the ...
1
vote
2answers
63 views

Grep line after/before -A/-B substitution in AIX

I'm using AIX 6.1 which isn't supporting in -B and -A flags: grep: Not a recognized flag: B Lets say I want to run: cat file | grep -E -B4 'Directory entry type.*Indirect' | grep "Database name" | ...
1
vote
3answers
49 views

Combining text across contiguous lines keyed alike?

I have an input CSV file that looks like this: john,Hello my name john,is John katie,Whereas my katie,name is Katie bob,And I am Bob. The file is ordered such that names (in the first column) are ...
2
votes
2answers
39 views

Script to modify XML config file

I'm trying to automate an installation process with a script. Part of the process is finding certain sections of the XML config file (seen below), and changing certain parameters from false to true or ...
1
vote
1answer
22 views

If #head versionnumber.txt < #head latestversionnumber.txt then: do this

I'm working on automating an update service. I created two text files that just contain the version number. versionnumber.txt: 3861 latestversionnumber.txt: 4002 How can I compare these two ...
3
votes
4answers
61 views

Find duplicates by column in a file

I have an input file containing file paths and their md5sum, separated by semicolons and sorted by md5 hashes : /media/LaCie/Images/recup2/recup_dir.1/f1295328.jpg;0080ececd3da8533f5d11e449cf73287 ...
1
vote
2answers
21 views

Strip certain objects out of a flat file database

I have a flat file database and I need to strip certain objects from it. There are numerous blocks in the file but I am interested in 2 objects in the OBJECT NickCore block. Example below: OBJECT ...
3
votes
1answer
22 views

Comparing ping times in FreeBSD sh

How can I strip the time from a ping return? For example: 64 bytes from 10.3.0.1: icmp_seq=0 ttl=63 time=2.610 ms I want to grab the value after time= and pass it to a test like: if time>=50.0; ...
0
votes
1answer
26 views

remove the last character of the line if it is a

I have a file of the form bulandshahara b u l a n d sh a h a r a caandapura c aa n d a p u r a I have to remove the "occurrence of a space followed by a" if this pattern appears at the last of ...
0
votes
2answers
22 views

Replace first occurrence of space with a TAB

I have a file of the form: acaneeraa a c a n ee r a acaneeraa a c a n ee r aa acaneeraa a c n ee r aa achaldaa a c a l d aa achaldaa a ch a l d aa I have to replace the first occurrence of a space ...

15 30 50 per page