<s>
A	O
filter	O
is	O
a	O
computer	B-Application
program	I-Application
or	O
subroutine	O
to	O
process	O
a	O
stream	B-Architecture
,	O
producing	O
another	O
stream	B-Architecture
.	O
</s>
<s>
While	O
a	O
single	O
filter	O
can	O
be	O
used	O
individually	O
,	O
they	O
are	O
frequently	O
strung	O
together	O
to	O
form	O
a	O
pipeline	B-Operating_System
.	O
</s>
<s>
Some	O
operating	B-General_Concept
systems	I-General_Concept
such	O
as	O
Unix	B-Application
are	O
rich	O
with	O
filter	O
programs	O
.	O
</s>
<s>
Windows	B-Device
7	I-Device
and	O
later	O
are	O
also	O
rich	O
with	O
filters	O
,	O
as	O
they	O
include	O
Windows	B-Application
PowerShell	I-Application
.	O
</s>
<s>
In	O
comparison	O
,	O
however	O
,	O
few	O
filters	O
are	O
built	O
into	O
cmd.exe	B-Device
(	O
the	O
original	O
command-line	B-Application
interface	I-Application
of	O
Windows	O
)	O
,	O
most	O
of	O
which	O
have	O
significant	O
enhancements	O
relative	O
to	O
the	O
similar	O
filter	O
commands	O
that	O
were	O
available	O
in	O
MS-DOS	B-Application
.	O
</s>
<s>
OS	B-Operating_System
X	I-Operating_System
includes	O
filters	O
from	O
its	O
underlying	O
Unix	B-Application
base	O
but	O
also	O
has	O
Automator	O
,	O
which	O
allows	O
filters	O
(	O
known	O
as	O
"	O
Actions	O
"	O
)	O
to	O
be	O
strung	O
together	O
to	O
form	O
a	O
pipeline	B-Operating_System
.	O
</s>
<s>
In	O
Unix	B-Application
and	O
Unix-like	B-Operating_System
operating	I-Operating_System
systems	I-Operating_System
,	O
a	O
filter	O
is	O
a	O
program	O
that	O
gets	O
most	O
of	O
its	O
data	O
from	O
its	O
standard	O
input	O
(	O
the	O
main	O
input	B-Architecture
stream	I-Architecture
)	O
and	O
writes	O
its	O
main	O
results	O
to	O
its	O
standard	O
output	O
(	O
the	O
main	O
output	O
stream	B-Architecture
)	O
.	O
</s>
<s>
Auxiliary	O
input	O
may	O
come	O
from	O
command	B-Application
line	I-Application
flags	O
or	O
configuration	O
files	O
,	O
while	O
auxiliary	O
output	O
may	O
go	O
to	O
standard	O
error	O
.	O
</s>
<s>
Filters	O
may	O
be	O
strung	O
together	O
into	O
a	O
pipeline	B-Operating_System
with	O
the	O
pipe	O
operator	O
("|"	O
)	O
.	O
</s>
<s>
The	B-Operating_System
Unix	I-Operating_System
philosophy	I-Operating_System
encourages	O
combining	O
small	O
,	O
discrete	O
tools	O
to	O
accomplish	O
larger	O
tasks	O
.	O
</s>
<s>
The	O
classic	O
filter	O
in	O
Unix	B-Application
is	O
Ken	O
Thompson	O
's	O
,	O
which	O
Doug	O
McIlroy	O
cites	O
as	O
what	O
"	O
ingrained	O
the	O
tools	O
outlook	O
irrevocably	O
"	O
in	O
the	O
operating	B-General_Concept
system	I-General_Concept
,	O
with	O
later	O
tools	O
imitating	O
it	O
.	O
</s>
<s>
This	O
finds	O
all	O
registered	O
users	O
that	O
have	O
"	O
foo	O
"	O
as	O
part	O
of	O
their	O
username	O
by	O
using	O
the	O
cut	B-Device
command	O
to	O
take	O
the	O
first	O
field	O
(	O
username	O
)	O
of	O
each	O
line	O
of	O
the	O
Unix	B-Application
system	I-Application
password	O
file	O
and	O
passing	O
them	O
all	O
as	O
input	O
to	O
grep	B-Application
,	O
which	O
searches	O
its	O
input	O
for	O
lines	O
containing	O
the	O
character	O
string	O
"	O
foo	O
"	O
and	O
prints	O
them	O
on	O
its	O
output	O
.	O
</s>
<s>
Common	O
Unix	B-Application
filter	I-Application
programs	O
are	O
:	O
cat	B-Device
,	O
cut	B-Device
,	O
grep	B-Application
,	O
head	B-Device
,	O
sort	B-Application
,	O
tail	B-Application
,	O
and	O
uniq	B-Application
.	O
</s>
<s>
Programs	O
like	O
awk	B-Application
and	O
sed	B-Application
can	O
be	O
used	O
to	O
build	O
quite	O
complex	O
filters	O
because	O
they	O
are	O
fully	O
programmable	O
.	O
</s>
<s>
Unix	B-Application
filters	I-Application
can	O
also	O
be	O
used	O
by	O
Data	O
scientists	O
to	O
get	O
a	O
quick	O
overview	O
about	O
a	O
file	O
based	O
dataset	O
.	O
</s>
<s>
Two	O
standard	O
filters	O
from	O
the	O
early	O
days	O
of	O
DOS-based	O
computers	O
are	O
find	O
and	O
sort	B-Application
.	O
</s>
<s>
Such	O
filters	O
may	O
be	O
used	O
in	O
batch	O
files	O
( *	O
.bat	O
,	O
*	O
.cmd	O
etc	O
.	O
</s>
<s>
Some	O
of	O
these	O
are	O
freeware	B-License
,	O
some	O
shareware	B-License
and	O
some	O
are	O
commercial	O
programs	O
.	O
</s>
<s>
A	O
number	O
of	O
these	O
mimic	O
the	O
function	O
and	O
features	O
of	O
the	O
filters	O
in	O
Unix	B-Application
.	O
</s>
<s>
Some	O
filtering	O
programs	O
have	O
a	O
graphical	B-Application
user	I-Application
interface	I-Application
(	O
GUI	B-Application
)	O
to	O
enable	O
users	O
to	O
design	O
a	O
customized	O
filter	O
to	O
suit	O
their	O
special	O
data	B-General_Concept
processing	I-General_Concept
and/or	O
data	B-Application
mining	I-Application
requirements	O
.	O
</s>
<s>
Windows	B-Device
Command	I-Device
Prompt	I-Device
inherited	O
MS-DOS	B-Application
commands	O
,	O
improved	O
some	O
and	O
added	O
a	O
few	O
.	O
</s>
<s>
For	O
example	O
,	O
Windows	B-Application
Server	I-Application
2003	I-Application
features	O
six	O
command-line	B-Application
filters	O
for	O
modifying	O
Active	B-Protocol
Directory	I-Protocol
that	O
can	O
be	O
chained	O
by	O
piping	O
:	O
DSAdd	O
,	O
DSGet	O
,	O
DSMod	O
,	O
DSMove	O
,	O
DSRm	O
and	O
DSQuery	O
.	O
</s>
<s>
Windows	B-Application
PowerShell	I-Application
adds	O
an	O
entire	O
host	O
of	O
filters	O
known	O
as	O
"	O
cmdlets	O
"	O
which	O
can	O
be	O
chained	O
together	O
with	O
a	O
pipe	O
,	O
except	O
a	O
few	O
simple	O
ones	O
,	O
e.g.	O
</s>
<s>
It	O
shows	O
how	O
three	O
filters	O
(	O
Get-ChildItem	O
,	O
ForEach-Object	O
and	O
Sort-Object	O
)	O
are	O
chained	O
with	O
pipes	B-Operating_System
.	O
</s>
