invert match with grep

September 16th, 2006 mysurface Posted in grep, Text Manipulation | Hits: 15724 | 2 Comments »

Usually if you want to search for string with specific keyword, you use grep.

cat /etc/passwd | grep root

This will list all lines with keyword “root” .

What if you want to list all entry without keyword “root” ?

cat /etc/passwd | grep -v root

2 Responses to “invert match with grep”

  1. I like the helpful info you provide in your articles. I’ll bookmark your weblog and check again here frequently. I’m quite sure I will learn many new stuff right here! Best of luck for the next!

  2. I do agree with all the ideas you’ve presented in your post. They’re very convincing and will certainly work. Still, the posts are too short for novices. Could you please extend them a little from next time? Thanks for the post.

Leave a Reply