[lug] Another sed question
Tkil
tkil at scrye.com
Sat Feb 4 00:43:10 MST 2006
>>>>> "Bill" == Bill Thoen <bthoen at gisnet.com> writes:
Bill> Given the following items in the file called 'list':
Bill> R21E
Bill> R142E
Bill> R12/SENW
Bill> R222W
Bill> R1E
Bill> I want to print out only the ones where the 'R' and following
Bill> number (which can be anything in the range of 0 to 999) is NOT
Bill> followed by an 'E'.
>>>>> "Tkil" == tkil <tkil at scrye.com> writes:
Tkil> Is there any reason to stick with 'sed'? This is a perfect use
Tkil> of "grep" (or its friends 'fgrep' and 'egrep'...):
Tkil> egrep '^R[0-9]{1,3}' list | egrep -v '.+E'
Sigh. I'm pretty sure you can change that latter command to:
grep -v E
I was being unnecessarily paranoid. (On the other hand, if you meant
to only omit those with an "E" right after the numerals, then two
pipelined 'grep's are probably the easiest way to do it at the command
line...
t.
More information about the LUG
mailing list