Question - Explain the term filter.
Answer -
A filter is described as a program, which takes input from the standard input, and displays results to the standard output by performing some actions on it.
Standard input could be text typed on the keyboard, input from other files or output of other files serving as input. Standard output is by default the display screen.
The most popular example of Unix filter id is grep command. This program look for a certain pattern in a file or list of files and only those lines are displayed on the output screen which contains the given pattern.
Syntax: $grep pattern file(s)
Some of the options that are used along with grep command are enlisted below:
-v: prints line that does not match the pattern.
-n: print matched line and line number.
-l: print file names with matching lines.
-c: prints only count the matching lines.
-i: matches either uppercase or lowercase.