<s>
grep	B-Application
is	O
a	O
command-line	B-Application
utility	O
for	O
searching	O
plain-text	O
data	O
sets	O
for	O
lines	O
that	O
match	O
a	O
regular	B-Language
expression	I-Language
.	O
</s>
<s>
Its	O
name	O
comes	O
from	O
the	O
ed	B-Application
command	B-Application
g/re/p	B-Application
(	O
globally	O
search	O
for	O
a	O
regular	B-Language
expression	I-Language
and	O
print	O
matching	O
lines	O
)	O
,	O
which	O
has	O
the	O
same	O
effect	O
.	O
</s>
<s>
grep	B-Application
was	O
originally	O
developed	O
for	O
the	O
Unix	B-Application
operating	I-Application
system	I-Application
,	O
but	O
later	O
available	O
for	O
all	O
Unix-like	B-Operating_System
systems	I-Operating_System
and	O
some	O
others	O
such	O
as	O
OS-9	B-Operating_System
.	O
</s>
<s>
Before	O
it	O
was	O
named	O
,	O
grep	B-Application
was	O
a	O
private	O
utility	O
written	O
by	O
Ken	O
Thompson	O
to	O
search	O
files	O
for	O
certain	O
patterns	O
.	O
</s>
<s>
Thompson	O
's	O
account	O
may	O
explain	O
the	O
belief	O
that	O
grep	B-Application
was	O
written	O
overnight	O
.	O
</s>
<s>
Thompson	O
wrote	O
the	O
first	O
version	O
in	O
PDP-11	B-Device
assembly	B-Language
language	I-Language
to	O
help	O
Lee	O
E	O
.	O
McMahon	O
analyze	O
the	O
text	O
of	O
The	O
Federalist	O
Papers	O
to	O
determine	O
authorship	O
of	O
the	O
individual	O
papers	O
.	O
</s>
<s>
The	O
ed	B-Application
text	I-Application
editor	I-Application
(	O
also	O
authored	O
by	O
Thompson	O
)	O
had	O
regular	B-Language
expression	I-Language
support	O
but	O
could	O
not	O
be	O
used	O
on	O
such	O
a	O
large	O
amount	O
of	O
text	O
,	O
so	O
Thompson	O
excerpted	O
that	O
code	O
into	O
a	O
standalone	O
tool	O
.	O
</s>
<s>
He	O
chose	O
the	O
name	O
because	O
in	O
ed	B-Application
,	O
the	O
command	B-Application
g/re/p	B-Application
would	O
print	O
all	O
lines	O
matching	O
a	O
specified	O
pattern	O
.	O
</s>
<s>
grep	B-Application
was	O
first	O
included	O
in	O
Version	B-Operating_System
4	I-Operating_System
Unix	I-Operating_System
.	O
</s>
<s>
Stating	O
that	O
it	O
is	O
"	O
generally	O
cited	O
as	O
the	O
prototypical	O
software	O
tool	O
"	O
,	O
McIlroy	O
credited	O
grep	B-Application
with	O
"	O
irrevocably	O
ingraining	O
"	O
Thompson	O
's	O
tools	B-Operating_System
philosophy	I-Operating_System
in	O
Unix	B-Application
.	O
</s>
<s>
A	O
variety	O
of	O
grep	B-Application
implementations	O
are	O
available	O
in	O
many	O
operating	O
systems	O
and	O
software	O
development	O
environments	O
.	O
</s>
<s>
Early	O
variants	O
included	O
egrep	O
and	O
fgrep	B-Device
,	O
introduced	O
in	O
Version	B-Operating_System
7	I-Operating_System
Unix	I-Operating_System
.	O
</s>
<s>
The	O
"	O
egrep	O
"	O
variant	O
supports	O
an	O
extended	O
regular	B-Language
expression	I-Language
syntax	O
added	O
by	O
Alfred	O
Aho	O
after	O
Ken	O
Thompson	O
's	O
original	O
regular	B-Language
expression	I-Language
implementation	O
.	O
</s>
<s>
The	O
"	O
fgrep	B-Device
"	O
variant	O
searches	O
for	O
any	O
of	O
a	O
list	O
of	O
fixed	O
strings	O
using	O
the	O
Aho	B-Algorithm
–	I-Algorithm
Corasick	I-Algorithm
string	I-Algorithm
matching	I-Algorithm
algorithm	I-Algorithm
.	O
</s>
<s>
Binaries	O
of	O
these	O
variants	O
exist	O
in	O
modern	O
systems	O
,	O
usually	O
linking	O
to	O
grep	B-Application
or	O
calling	O
grep	B-Application
as	O
a	O
shell	O
script	O
with	O
the	O
appropriate	O
flag	O
added	O
,	O
e.g.	O
</s>
<s>
exec	O
grep	B-Application
-E	O
"	O
$@	O
"	O
.	O
</s>
<s>
egrep	O
and	O
fgrep	B-Device
,	O
while	O
commonly	O
deployed	O
on	O
POSIX	O
systems	O
,	O
to	O
the	O
point	O
the	O
POSIX	O
specification	O
mentions	O
their	O
widespread	O
existence	O
,	O
are	O
actually	O
not	O
part	O
of	O
POSIX	O
.	O
</s>
<s>
Other	O
commands	O
contain	O
the	O
word	O
"	O
grep	B-Application
"	O
to	O
indicate	O
they	O
are	O
search	O
tools	O
,	O
typically	O
ones	O
that	O
rely	O
on	O
regular	B-Language
expression	I-Language
matches	O
.	O
</s>
<s>
The	O
pgrep	B-Device
utility	O
,	O
for	O
instance	O
,	O
displays	O
the	O
processes	O
whose	O
names	O
match	O
a	O
given	O
regular	B-Language
expression	I-Language
.	O
</s>
<s>
In	O
the	O
Perl	B-Language
programming	I-Language
language	I-Language
,	O
grep	B-Application
is	O
the	O
name	O
of	O
the	O
built-in	O
function	O
that	O
finds	O
elements	O
in	O
a	O
list	O
that	O
satisfy	O
a	O
certain	O
property	O
.	O
</s>
<s>
This	O
higher-order	B-Language
function	I-Language
is	O
typically	O
named	O
filter	B-Application
or	O
where	O
in	O
other	O
languages	O
.	O
</s>
<s>
The	O
pcregrep	O
command	B-Application
is	O
an	O
implementation	O
of	O
grep	B-Application
that	O
uses	O
Perl	B-Language
regular	B-Language
expression	I-Language
syntax	O
.	O
</s>
<s>
Similar	O
functionality	O
can	O
be	O
invoked	O
in	O
the	O
GNU	O
version	O
of	O
grep	B-Application
with	O
the	O
-P	O
flag	O
.	O
</s>
<s>
Ports	O
of	O
grep	B-Application
(	O
within	O
Cygwin	B-Language
and	O
GnuWin32	B-Language
,	O
for	O
example	O
)	O
also	O
run	O
under	O
Microsoft	B-Application
Windows	I-Application
.	O
</s>
<s>
Some	O
versions	O
of	O
Windows	O
feature	O
the	O
similar	O
qgrep	O
or	O
findstr	B-Algorithm
command	B-Application
.	O
</s>
<s>
A	O
grep	B-Application
command	B-Application
is	O
also	O
part	O
of	O
ASCII	O
's	O
MSX-DOS2	O
Tools	O
for	O
MSX-DOS	B-Operating_System
version	O
2	O
.	O
</s>
<s>
The	O
,	O
,	O
and	O
commands	O
have	O
also	O
been	O
ported	O
to	O
the	O
IBM	B-Application
i	I-Application
operating	O
system	O
.	O
</s>
<s>
The	O
software	O
Adobe	B-Operating_System
InDesign	I-Operating_System
has	O
functions	O
GREP	B-Application
(	O
since	O
CS3	O
version	O
(	O
2007	O
)	O
)	O
,	O
in	O
the	O
find/change	O
dialog	O
box	O
"	O
GREP	B-Application
"	O
tab	O
,	O
and	O
introduced	O
with	O
InDesign	B-Operating_System
CS4	O
in	O
paragraph	O
styles	O
"	O
GREP	B-Application
styles	O
"	O
.	O
</s>
<s>
agrep	B-Device
(	O
approximate	B-Device
grep	I-Device
)	O
matches	O
even	O
when	O
the	O
text	O
only	O
approximately	O
fits	O
the	O
search	O
pattern	O
.	O
</s>
<s>
The	O
command	B-Application
flag	O
B	O
means	O
best	O
:	O
</s>
<s>
In	O
December	O
2003	O
,	O
the	B-Application
Oxford	I-Application
English	I-Application
Dictionary	I-Application
Online	O
added	O
"	O
grep	B-Application
"	O
as	O
both	O
a	O
noun	O
and	O
a	O
verb	O
.	O
</s>
<s>
A	O
common	O
verb	O
usage	O
is	O
the	O
phrase	O
"	O
You	O
ca	O
n't	O
grep	B-Application
dead	O
trees	O
"	O
—	O
meaning	O
one	O
can	O
more	O
easily	O
search	O
through	O
digital	O
media	O
,	O
using	O
tools	O
such	O
as	O
grep	B-Application
,	O
than	O
one	O
could	O
with	O
a	O
hard	O
copy	O
(	O
i.e.	O
</s>
