

Warning: include() [function.include]: URL file-access is disabled in the server configuration in /home/2332/unix-man/www.unix-manuals.com/public_html/quicktips/unix/grep.html on line 18
Warning: include(http://www.unix-manuals.com/topad.php) [function.include]: failed to open stream: no suitable wrapper could be found in /home/2332/unix-man/www.unix-manuals.com/public_html/quicktips/unix/grep.html on line 18
Warning: include() [function.include]: Failed opening 'http://www.unix-manuals.com/topad.php' for inclusion (include_path='.:/usr/share/pear:/usr/share/php') in /home/2332/unix-man/www.unix-manuals.com/public_html/quicktips/unix/grep.html on line 18
NOTICE - New forum for all UNIX learners, users and programmers - click here
Find text within a file or set of files
UNIX® systems provide a useful command for
searching for text within files. The command is named 'grep', for
reasons which are unknown to us.
In its simplest form, the command syntax is:
grep text file
The command returns the whole of any lines in the file which
contain the specified text.
For example:
$ grep John phone-numbers.txt
John Hammonds: 01-639-203-791
John Millerchip: 01-541-201-363
$
You may specify more than one filename, or use wildcards such as
'*.txt'. Grep includes many useful options, such as the ability to
list the line number that the match(es) appear on, or to list only
lines which do not contain
the specified text. Look at the man page for 'grep', and try some
examples it's a very useful command to get to know well.
Click here for the next
Quick Tip

Warning: include() [function.include]: URL file-access is disabled in the server configuration in /home/2332/unix-man/www.unix-manuals.com/public_html/quicktips/unix/grep.html on line 51
Warning: include(http://www.unix-manuals.com/botad.php) [function.include]: failed to open stream: no suitable wrapper could be found in /home/2332/unix-man/www.unix-manuals.com/public_html/quicktips/unix/grep.html on line 51
Warning: include() [function.include]: Failed opening 'http://www.unix-manuals.com/botad.php' for inclusion (include_path='.:/usr/share/pear:/usr/share/php') in /home/2332/unix-man/www.unix-manuals.com/public_html/quicktips/unix/grep.html on line 51
© Copyright
2000-2003, Tom Reader, All Rights Reserved.
UNIX is a registered
trademark of The Open Group in the US and other countries.
For
more information on the use of the UNIX trademark, click
here.
The contents of this site are not connected with or
endorsed by The Open Group in any way.