Location: Saint Paul, MN USA / BSD, CentOS, Debian, OS X, Solaris
Posts: 2,288
Thanks Given: 430
Thanked 480 Times in 395 Posts
Hi.
Some versions of grep or grep-like utilities can do this. For example, the very versatile cgrep can. Here is a sample of first extracting the string plus the trailing window, then the inversion of that operation, which effectively deletes it, both operations writing to STDOUT:
producing:
So cgrep is not very diffferent from sed when cgrep is used this way. Where it might be superior to sed is in the selection of context window limits: regular expressions and line counts (the latter as shown above) can be used to mark easily the leading and trailing boundaries of a window.
You may need to download and compile cgrep, see the URL in the code above. I have done so on 32-bit and 64-bit GNU/Linux systems.
Best wishes ... cheers, drl
Last edited by vgersh99; 08-14-2009 at 12:16 PM..
Reason: fixed code tag
The intended result should be :
PDF converters
'empty line'
gpdftext and pdftotext?xml version="1.0"?>
xml:space="preserve"><note-content version="0.1" xmlns:/tomboy/link" xmlns:size="http://beatniksoftware.com/tomboy/size">PDF converters
gpdftext and pdftotext</note-content>... (9 Replies)
hi
I have a large xml file from which i have taken few lines . In this file I have to find for the string </invoices> and check if the 3 rd line after this string does not begin with <portCode> ,then i have to delete the string </invoices> and the next line having the string </shippingBill>... (13 Replies)
Hi,
I need to delete all lines in the file using vi editor which start with word aternqaco.
Please assist.
aternqaco.__oracle_base='/amdbqa01/app/oracle'#ORACLE_BASE set from environment
aternqa.__oracle_base='/amdbqa01/app/oracle'#ORACLE_BASE set from environment... (3 Replies)
I have a header-detail file that goes like this:
SHP00288820131021110921
ORDER0156605920131021110921INMMMMFN
DETAIL0004 4C2Z 10769 AAFC 0000009600000094 4C2Z 10769 AAFC 0000672107 OIL
DETAIL0002 ER3Z 14300 E 0000001300000012 ER3Z 14300 E 0000672107 OIL... (3 Replies)
Hi,
I have a requirement to to an ldapsearch and remove the shadow attributes in the output file.
What I do is ldapsearch() | operation to remove shadow > FILE
The ldapsearch gives output like this(with same line formation):
objectClass: FSConfig
objectClass: extensibleObject
fsCAIP:... (10 Replies)
HI,
My input file contains below data:
DFHDR
12345110
1,200
2,-100
1,100
2,123
12345110
1,300
2,200
DFTLR
In the above data, the first line and last lines should be remove as well as the lines in which contains 110 as position(6,7,8 position) should also be removed,
How we... (0 Replies)
In Unix, how do I delete lines in a file that match a particular pattern without opening it. File contents are
foo line1
misc
whatever
foo line 2
i want to delete all lines that have the pattern "foo" without opening the file. File should eventually contain
misc
whatever (1 Reply)
I've got a longish log file with content such as
Uplink traffic:
Downlink traffic:
I want to parse the log file and remove any line that contains the string "Uplink traffic:" at the beginning of the line, but only if the line following it beginnings with the string "Downlink traffic:" (in... (7 Replies)
I want to delete lines like this
sed '/FROM_HERE/,/TO_HERE/d'
but I would like to *not* delete the second match, i.e. the TO_HERE line. How can I achieve this?
Thank you! (1 Reply)
I have seen there are many sed posts but still it is quite difficult to apply other post to my own problem
How can I delete all lines in a file from 2 lines after this pattern
*End_fine_coreg:_NORMAL
to the end of file?
Cheers (2 Replies)