*** UNIX MANUAL PAGE BROWSER ***

A Nergahak database for man pages research.

Navigation

Directory Browser

1Browse 4.4BSD4.4BSD
1Browse Digital UNIXDigital UNIX 4.0e
1Browse FreeBSDFreeBSD 14.3
1Browse MINIXMINIX 3.4.0rc6-d5e4fc0
1Browse NetBSDNetBSD 10.1
1Browse OpenBSDOpenBSD 7.7
1Browse UNIX v7Version 7 UNIX
1Browse UNIX v10Version 10 UNIX

Manual Page Search

Manual Page Result

0 Command: gre | Section: 1 | Source: UNIX v10 | File: gre.1
GRE(1) General Commands Manual GRE(1) NAME gre, grep, egrep, fgrep - search a file for a pattern SYNOPSIS gre [ option ... ] pattern [ file ... ] grep [ option ... ] pattern [ file ... ] egrep [ option ... ] pattern [ file ... ] fgrep [ option ... ] strings [ file ... ] DESCRIPTION Gre searches the input files (standard input default) for lines (with newlines excluded) that match the pattern, a regular expression as de- fined in re(3). A file name of - is interpreted as standard input. Normally, each line matching the pattern is `selected', and each se- lected line is copied to the standard output. The options are -1 Print only the first selected line of each file argument. -b Mark each printed line with its byte position in its file. This is sometimes useful in locating patterns in non-text files. -c Print only a count of matching lines. -e pattern Same as a simple pattern argument, but useful when pattern be- gins with a -. -E Simulate egrep. -f file Read the pattern from file; there is no pattern argument -F Simulate fgrep. -G Simulate grep. -h Do not print filename tags (headers) with output lines. -i Ignore alphabetic case distinctions. -l 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. -x Exact match: The pattern is ^(pattern)$. The implicit parenthe- ses count in back references. Output lines are tagged by filename when there is more than one input file. (To force this tagging, include /dev/null as a filename argu- ment.) If the output line exceeds some internal limit, a warning is given and a small block of text surrounding the match is printed. Care should be taken when using the shell metacharacters $*[^|()\ and newline in pattern; it is safest to enclose the entire expression in single quotes '...'. Gre supplants three classic programs, which are still available: Grep handles only ed(1)-like regular expressions. It uses instead of Egrep handles the same patterns as gre except for back-referencing with \1, \2, ... Fgrep handles no operators except newline (alternation). SEE ALSO re(3), awk(1), sed(1), sam(9.1), strings(1) DIAGNOSTICS Exit status is 0 if any lines are selected, 1 if none, 2 for syntax er- rors, inaccessible files (even if matches were found). Warnings will be given for input lines that exceed a (generous) internal limit. BUGS Grep, egrep, and fgrep do not support some options and print (approxi- mate) block numbers rather than byte numbers for option -b. Egrep may fail on input containing characters greater than 0176. GRE(1)

Navigation Options