PROPHET/OS

NAME

grep: reads lines from in and writes the ones that hold the text to out

SYNOPSIS

grep [-i] [-v] [-n] [-c] [-e] <text>

DESCRIPTION

Reads lines from in and writes the ones that hold the text to out.

-i   ignore case
-v   turn it around: the lines that do not hold it
-n   put the line number in front
-c   write only how many there were
-e   read the text as a pattern

The pattern language:

.      any character        *   none or more
+      one or more          ?   none or one
^      the start            $   the end
[abc]  one of them          [a-z] a range      [^abc] none of them

Without -e the text is taken literally, dots and stars included. That is the safer default: most searches are for a string, and a string that happens to contain a dot should not silently match everything.

EXAMPLE

$ grep --help
grep [-i] [-v] [-n] [-c] [-e] <text>
  reads lines from in, writes the ones that hold the text to out
  -i ignores case, -v turns it around, -n puts the line
  number in front, -c writes only how many there were
  -e reads the text as a pattern:
     .  any char     *  none or more   +  one or more
     ?  none or one  ^  the start      $  the end
     [abc] one of them, [a-z] a range, [^abc] none of them

SEE ALSO

find, sort, uniq, wc