One of the powerful and widely used command in shell is
grep. It searches in an input file and matches lines in which the given pattern is found. By default, all the matched patterns are printed on
stdout that is usually terminal. We can also redirect the matched output to other streams such as file. Instead of giving an input from a file,
grep can also take the input from the redirected output of the command executed on the left-hand side of '
The syntax of using the
grep command is as follows:
grep [OPTIONS] PATTERN [FILE...]
FILE can be multiple files for a search. If no file is given as an input for a search, it will search the standard input.
PATTERN can be any valid regular expression. Put