grep and so on

grep family.

basic usage: grep pattern filenames
Search for pattern and print the line found the input.

usefull options:

regular expressions.

basic rule
c : any non-special character c matches itself.
\c : turn off any special meaning of c.

^: beginning of the line.
$: end of line.
.: any single character.
[abc]: any single character match a, b or c.
[^abc]: any single character doesn’t match a, b nor c.
r*: zero of more occurence of r.
r+: one of more occurence of r(egrep only). r?: zero of one occurence of r(egrep only).
r1|r2: match r1 or r2(egrep only).

grep ,egrep and fgrep

These greps are different accourding to the blue cover unix manual. They are different execuable under bin in old times.

Now, according to my Linux man(1) page:

$egrep = $grep -E : e is extended-regexp.
$fgrep = $grep -F : f fixed strings. Interpret PATTERN as a list of fixed strings (instead of regular expressions), separated by newlines, any of which is to be matched.

According to the blue unix, fgrep can look efficiently for thousands of words in parallel.

See also:

Jiayang, Sun 20 January 2017
blog comments powered by Disqus