SEARCH
NEW RPMS
DIRECTORIES
ABOUT
FAQ
VARIOUS
BLOG
DONATE




YUM REPOSITORY

 
 

GREP

Section: User Commands (1)
Index 

NAME

grep, g - search a file for a pattern 

SYNOPSIS

grep[option ...]pattern[file ...]

g[option ...]pattern[file ...] 

DESCRIPTION

Grepsearches the inputfiles(standard input default)for lines that match thepattern,a regular expression as defined inregexp(7)with the addition of a newline character as an alternative(substitute for|)with lowest precedence.Normally, each line matching the pattern is `selected',and each selected line is copied to the standard output.The options are
-c
Print only a count of matching lines.
-h
Do not print file name tags (headers) with output lines.
-e
The following argument is taken as apattern.This option makes it easy to specify patterns thatmight confuse argument parsing, such as-n.
-i
Ignore alphabetic case distinctions. The implementationfolds into lower case all letters in the pattern and input beforeinterpretation. Matched lines are printed in their original form.
-l
(ell) Print the names of files with selected lines; don't print the lines.
-L
Print the names of files with no selected lines;the converse of-l.
-n
Mark each printed line with its line number counted in its file.
-s
Produce no output, but return status.
-v
Reverse: print lines that do not match the pattern.
-f
The pattern argument is the name of a file containing regularexpressions one per line.
-b
Don't buffer the output: write each output line as soon as it is discovered.

Output lines are tagged by file name when there is more than oneinput file.(To force this tagging, include/dev/nullas a file name argument.)

Care should be taken whenusing the shell metacharacters$*[^|()=\and newlineinpattern;it is safest to enclose theentire expressionin single quotes'...'.An expression starting with '*'will treat the rest of the expressionas literal characters.

Ginvokes grep with-nand forces tagging of output lines by file name.If no files are listed, it searches all files matching

*.C *.b *.c *.h *.m *.cc *.java *.cgi *.pl *.py *.tex *.ms
 

SOURCE

/src/cmd/grep
/bin/g 

SEE ALSO

ed(1),awk(1),sed(1),sam(1),regexp(7) 

DIAGNOSTICS

Exit status is null if any lines are selected,or non-null when no lines are selected or an error occurs.


 

Index

NAME
SYNOPSIS
DESCRIPTION
SOURCE
SEE ALSO
DIAGNOSTICS

This document was created byman2html,using the manual pages.