Filter (software)

from Wikipedia, the free encyclopedia

In the area of software development and application, a filter is a (partial) function of a program that checks incoming data according to specified criteria and only feeds the data corresponding to the criteria for further processing or forwards it into the output data stream.

In a broader sense, this term also includes a group of command line programs in the terminology of Unix-like operating systems , by means of which the read-in data is not only reduced to subsets, but also changed (reshaped, modified, manipulated, expanded, enriched, merged, etc.).

Filter as a command line function

The term filter originally comes from the UNIX operating system , which offers a wide range of programs that can be used as "filters": tr , sed , grep , join , awk , to name just a few. In particular, the concept of pipelines introduced under Unix is ideally suited for using such filters for post-processing or also for the evaluation of databases.

The concept of filters was also adopted in other operating systems (such as VMS , but also MS-DOS and its descendants), but mostly to a much lesser extent compared to UNIX-like systems.

It should be noted that the term filter is only used colloquially and that there is no exact scientific definition. So what exactly a filter is and whether a specific piece of software can be described as such, there can be very different opinions.

functionality

Filters are typically used in a pipeline or their equivalent, i.e. they receive data from <stdin>and give up the result of their processing <stdout>. However, this is by no means absolutely necessary; the input can also take place via file I / O or other ways, as in the example.

Example for Unix and Unix-like systems

The example filters the comment header from a script file ( KornShell script) up to the first non-comment line and outputs this part of the script to : <stdout>

sed '1d;/^#/ !{d;q}' /path/to/script.ksh

Example for DOS and DOS-like

Already because of the absence of a RegExp - Engine , the above example can be replicated with native DOS commands is limited. The following command outputs all comment lines of a specified script file, regardless of where they appear:

find "REM" c:\path\to\script.bat

Filters in other applications

In general in the software area, filters are software functions that check input data to determine whether they meet certain filter criteria, with the aim of either processing / outputting only certain data (and not others) or, conversely, not processing them. The criteria must be available in a form ( syntax ) established for the filter routine in order to be able to be interpreted or processed, and it must also be established whether they should act as exclusion or inclusion criteria.

Examples from other applications

  • In Internet travel portals , hotels to be displayed can usually be filtered using categories (e.g. number of stars, relaxation or activity, etc.) and other properties (animals allowed, proximity to the beach, WiFi, etc.) by defining appropriate criteria.
  • In spreadsheet applications, filters can usually be set column by column which only display the rows that meet the criteria.
  • In programs for batch processing , filter routines can exclude certain input data from processing; For details see also standardized programming .
  • Many Internet search engines allow search results to be filtered by language and country or by date of creation.
  • In the SORT utility routine of most types of computers there is a filter option with which only the input data are processed (= sorted and output) that meet the filter criteria.

In a broader sense, there is also a filtering when processing data from databases : The amount of data that is to be processed is determined with special selection commands, for example invoices to customers who have been unpaid for ? days, and their address data.

See also

Individual evidence

  1. ^ Exam 101 Objectives. In: LPIC-1: System Administrator: Exam 101 Objectives; Version 4.0. Linux Professional Institute , accessed July 8, 2018 .