[lug] sed question - specifying alternatives

Bill Thoen bthoen at gisnet.com
Fri Feb 3 11:17:19 MST 2006

I'm trying to get sed to recognize two types of records in a file.
Basically, I don't care what's in th efirst 11 places, but after that I
want any record where 001 or 015 are in the 12th through 15th positions.
When I try:

sed -n -e '/^.\{11\}(001\|015)/p' tblDesc.txt

I get nothing, but

sed -n -e '/^.\{11\}001/p' tblDesc.txt
sed -n -e '/^.\{11\}015/p' tblDesc.txt

work just fine. I checked 'info sed' and then looked at the section on
regular expressions and it seems to allow alternatives in parentheses, but
I can't get this to work. Any ideas?


 - Bill Thoen

More information about the LUG mailing list