[lug] Another sed question
Bill Thoen
bthoen at gisnet.com
Fri Feb 3 16:45:25 MST 2006
Thanks for the help with my last sed problem, but now I have a new one and
the book and the info file are not helping. Given the following items in
the file called 'list':
R21E
R142E
R12/SENW
R222W
R1E
I want to print out only the ones where the 'R' and following number (which
can be anything in the range of 0 to 999) is NOT followed by an 'E'. So I
try this:
$ sed -n -e '/R[0-9]\{1,3\}[^E]/p' list
and it doesn't work. Actually, it does... but only on the last record with
a 1 digit number.
But the reverse logic (print out records where the R-number IS followed by
'E') works with the following sed command:
$ sed -n -e '/R[0-9]\{1,3\}[E]/p' list
So how do I print out all records where the R-numbers are NOT followed by
'E'?
- Bill Thoen
More information about the LUG
mailing list