Grep

grep exclude -v

tail -f access.log | grep -v "192.168.1.101"

What this will do is show everything, apart from a line with that IP address in.

Of course, this works with any other command with text being piped into grep:

cat file.txt | grep -v "heh"

This would output the contents of file.txt but remove any lines with “heh” in them.

Exclude case from a grep to make it not case sensitive – simply add -i:

grep -i “Hello” textfile.txt

Alternatively, you could use it in conjunction with cat and tac (Reverse Cat)

cat textfile.txt | grep -i “Hello”

2019-04-05 15:24:14

Comments

Add a Comment

Login or Register to post a Comment.

Homepage