www.digitalmars.com [Home] [Search] [CTG] [RTL] [UGR] [STL]

GREP: Search Files for Pattern

GREP is used to search for strings in multiple files.

Command syntax:

	grep [switches] pattern { file }
pattern is the string to search for.
file is the name of the file to search. Multiple files can be listed, and wildcards can be used.
-h Suppress printing of filenames.
-i Become case-insensitive.
-r Recursively search subdirectories.
-v Verbose; print name of each subdirectory as it is searched.
-z Search for wide character strings.
GREP will print each line in each file that contains a match for pattern. It works with binary files as well as text files.

Example:

To search all .c files for the string 'this':
	grep this *.c
	

Copyright © 1995-2001 Digital Mars. All Rights Reserved.