Home
| Calendar
| Mail Lists
| List Archives
| Desktop SIG
| Hardware Hacking SIG
Wiki | Flickr | PicasaWeb | Video | Maps & Directions | Installfests | Keysignings Linux Cafe | Meeting Notes | Linux Links | Bling | About BLU |
Greetings, and I hope this isn't a "D'oh!" question that will make me kick myself.. :-) I wanna use grep to match on lines in a file that begin with either of 2 patterns. As far as I understand regex's, I should use ^(...|...) to do this, as in: grep ^(fee|fie) junk.txt Obviously this won't work b/c there are some characters there that are meaningful to the shell. According to man grep, I should enclose my pattern in single quotes to get around this: grep '^(fee|fie)' junk.txt However, this produces no lines of output (even though I know both patterns are there). I have tried other alternatives, like grep ^\(fee\|fie\) junk.txt with no success. I can get the desired result with: perl -ne 'print if /^(fee|fie)/' junk.txt but that's a kludge. It'd be nice to know how to make grep do this. Many thanks for any help!!! :-) -- Ken Gosier ken at kg293.net ken_gosier at yahoo.com
BLU is a member of BostonUserGroups | |
We also thank MIT for the use of their facilities. |