LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   not operator with grep (https://www.linuxquestions.org/questions/linux-newbie-8/not-operator-with-grep-605146/)

bzlaskar 12-07-2007 03:34 AM

not operator with grep
 
Greetings,

I want to display all lines from /etc/passwd file that does
not start with z.

How can I construct such a statement using grep.

grep -e ^z /etc/passwd

This command will display all lines starting with z.If
I add a not operator , my work will be done.

But I am not getting which null operator to use...

Please suggest me the correct grep command . With thanks in Advance.

matthewg42 12-07-2007 03:41 AM

The -v option inverts the output (i.e. outputs all input lines which do not match the pattern).

bzlaskar 12-07-2007 03:46 AM

Thanks Mathew for a quick reply.


Quote:

Originally Posted by matthewg42 (Post 2983004)
The -v option inverts the output (i.e. outputs all input lines which do not match the pattern).



All times are GMT -5. The time now is 06:50 PM.