An Introduction to Regular Expressions The grep Operator 38 of 50 : [PREV] [NEXT]

The grep Operator

Syntax

Lastly, but by no means least we have 'grep'. The operator that pioneered the use of regular expressions. Its very name gives it a clue to it's syntax:

g/re/p
Global/Regular Expression/Print

The syntax for grep is:

grep [!]/PATTERN/, LIST

Using the '!' before the PATTERN negates the match.


© 2003 Barbie barbie@missbarbell.co.uk Home http://birmingham.pm.org/