Linux: grep, part0

Written by

in

The grep command is a Linux shell one for finding strings.

The following is by my understanding.

The grep command is used to find a string and will print out each line that contains it.

grep “log” a-file.txt

will print, to terminal, each line from a-file.txt that contains the string “log”.

grep log a-file.txt

seems to work the same as if “log” is in quotes.

The grep command can be used with regular expressions. For example,

grep -E gre”e|a”t a-file.txt

will find “great” or “greet” in a-file.txt. The -E switch means you don’t need to escape the | operator.

Source:

linux.die.net

-JS

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *