A filter is a computer program or routine to process a data stream. Some operating systems such as Unix are rich with filter programs. Windows also has some simple filters built into its command shell, most of which have significant enhancements relative to the similar filter commands that were available in MS-DOS.
In shells on Unix-like operating systems and in the modern Windows shell, such a filter usually gets most of its data from standard input (the main input stream) and writes its main results to standard output (the main output stream). The command syntax for getting data from a device or file other than standard input is the input operator ("<"). Similarly, to send data to a device or file other than standard output is the output operator (">"). To append data lines to an existing output file, one can use the append operator (">>"). Filters may be strung together into a pipeline with the pipe operator ("|"). This operator signifies that the main output of the command to the left is passed as main input to the command on the right.
Filters on DOS and Windows
- find "keyword" < inputfilename > outputfilename
- sort "keyword" < inputfilename > outputfilename
- find /v "keyword" < inputfilename | sort > outputfilename
Such filters may be used in batch files (*.bat, *.cmd etc.).
For use in the same command shell environment, there are many more filters available than those built into Windows. Some of these are freeware, some shareware and some are commercial programs. A number of these mimic the function and features of the filters in Unix. Some filtering programs have a graphical user interface (GUI) to enable users to design a customized filter to suit their special data processing and/or data mining requirements.