Location: Saint Paul, MN USA / BSD, CentOS, Debian, OS X, Solaris
Thanks Given: 430
Thanked 480 Times in 395 Posts
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:
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 :
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)
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)
I need to delete all lines in the file using vi editor which start with word aternqaco.
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:
DETAIL0004 4C2Z 10769 AAFC 0000009600000094 4C2Z 10769 AAFC 0000672107 OIL
DETAIL0002 ER3Z 14300 E 0000001300000012 ER3Z 14300 E 0000672107 OIL... (3 Replies)
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):
fsCAIP:... (10 Replies)
My input file contains below data:
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 line 2
i want to delete all lines that have the pattern "foo" without opening the file. File should eventually contain
whatever (1 Reply)
I've got a longish log file with content such as
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 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
to the end of file?
Cheers (2 Replies)