[help with grep]

Andy Jack f.e.jack-bJEeYj9oJeDQT0dZR+AlfA at public.gmane.org
Mon Dec 15 12:36:43 UTC 2003


If you want to grep for DPT=22 followed by a space, then grep for it:

grep 'DPT=22 ' file
            ^
            space!

Why do you pipe to "cat" and redirect?  Direct redirection should also
have the desired effect:

grep 'DPT=22 ' file > dp22

The reason that grep DPT=22\> doesn't work is that the \> probably gets
grabbed by your shell and handed to grep as a bare >, the \ being the
shell escape character, so what grep actually sees is DPT=22>.
Quote-protect the grep pattern so the shell doesn't mess around with it.

grep 'DPT=22\>' file > dp22

Bonne chance,
Andy
--
The Toronto Linux Users Group.      Meetings: http://tlug.ss.org
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://tlug.ss.org/subscribe.shtml





More information about the Legacy mailing list