Filter (software)

From Wikipedia, the free encyclopedia
Jump to: navigation, search

A filter is a computer program or subroutine to process a stream, producing another stream. While a single filter can be used individually, they are frequently strung together to form a pipeline.

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. Mac OS X, in addition to the filters available from the underlying Unix base, also has the Automator application, which allows filters (known as "Actions") to be strung together to form a pipeline.

Unix[edit]

In shells on Unix-like operating systems and in the modern Windows shell, filters default to getting their data from standard input (the main input stream) and writing their output to standard output (the main output stream); auxiliary input may come from command line flags or configuration files, while auxiliary output may go to standard error. 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.

DOS and Windows[edit]

Two standard filters from the early days of DOS-based computers are find and sort.

Examples:

  • 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.

External links[edit]