AT&T UNIX™PC Unix System V Users Manual - tenox
AT&T UNIX™PC Unix System V Users Manual - tenox AT&T UNIX™PC Unix System V Users Manual - tenox
GREP ( 1) GREP (1) NAME grep, egrep, fgrep - search a file for a pattern SYNOPSIS grep [ options ] expression [ files ] egrep [ options ] [expression ] [ files ] fgrep [ options ] [ strings ] [ files ] DESCRIPTION Commands of the grep family search the input files (standard input default) for lines matching a pattern. Normally, each line found is copied to the standard output. Grep patterns are limited regular expressions in the style of ed(1); grep uses a compact non-deterministic algorithm. Egrep patterns are full regular expressions; it uses a fast deterministic algorithm that sometimes needs exponential space. Fgrep patterns are fixed strings; it is fast and compact. The following options are recognized: -v All lines but those matching are printed. -c Only a count of matching lines is printed. -i Ignore upper/lower case distinction during compare. -x (Exact) only lines matched in their entirety are printed (fgrep only). -1 Only the names of files with matching lines are listed (once), separated by new-lines. -n Each line is preceded by its relative line number in the file. -b Each line is preceded by the block number on which it was found. This is sometimes useful in locating disk block numbers by context. -s The error messages produced for nonexistent or unreadable files are suppressed (grep only). -eexpression Same as a simple expression argument, but useful when the expression begins with a-(does not work with grep ). -ffile The regular expression ( egrep) or strings list (fgrep ) is taken from the file . In all cases, the file name is output if there is more than one input file. Care should be taken when using the characters $, *, [, �, 1, ( , ), and \ in expression, because they are also meaningful to the shell. It is safest to enclose the entire expression argument in single quotes 1 . . . 1 . Fgrep searches for lines that contain one of the strings separated by new-lines. Egrep accepts regular expressions as in ed(1), except for \( and \), with the addition of: 1. A regular expression followed by + matches one or more occurrences of the regular expression. 2. A regular expression followed by ? matches 0 or 1 occurrences of the regular expression. 3. Two regular expressions separated by 1 or by a new-line match strings that are matched by either. 4. A regular expression may be enclosed in parentheses () for grouping - 1 -
- Page 291: DIRCMP ( 1) DIRCMP ( 1) NAME dircmp
- Page 295 and 296: DUMP ( 1 ) DUMP(!) NAME dump - dump
- Page 297: ECHO (l) ECHO (l) NAME echo - echo
- Page 300 and 301: ED ( l ) ED {1) the RE. The REs all
- Page 302 and 303: ED (l) ED (1) . 6. FILES below. A R
- Page 304 and 305: ED ( 1 ) ED ( 1) command list is eq
- Page 306 and 307: ED (1) ED (l) replaced by the repla
- Page 308 and 309: ED (l) ED (1) FILES /tmp/e# tempora
- Page 311: ENV ( 1) ENV(l) NAME env - set envi
- Page 314 and 315: EQN(l) EQN( 1) [ • '+ � ] � l
- Page 316 and 317: � I )
- Page 318 and 319: EX (l) BUGS EX (l) The undo command
- Page 320 and 321: EXPR(l) EXPR ( l ) 3. 4. returns th
- Page 323 and 324: FC(l) ( AT&T UNIX PC only ) FC ( l
- Page 325: FILE ( 1 ) FIT..E ( 1 ) NAME file -
- Page 328 and 329: FIND ( 1 ) FIND ( 1 ) -print -cpio
- Page 330 and 331: GET(l) -b -ilist -xlist GET(l) furt
- Page 332 and 333: GET(l) GET(l) TABLE 1. Determinatio
- Page 334 and 335: GET(l) GET(l) generated by the get.
- Page 337 and 338: GETOPT ( 1) GETOPT ( l ) NAME getop
- Page 339: GREEK (l) GREEK(l) NAME greek - sel
- Page 343 and 344: HEAD ( l ) HEAD ( l ) NAME head - g
- Page 345 and 346: HELP ( l ) HELP ( l ) NAME help - a
- Page 347 and 348: HP ( 1 ) HP ( 1) NAME hp - handle s
- Page 349: HYPHEN ( I) HYPHEN(!) NAME hyphen -
- Page 353: IPCRM ( 1) IPCRM ( l ) NAME ipcrm -
- Page 356 and 357: IPCS ( 1) IPCS ( 1) The column head
- Page 358 and 359: IPCS ( 1) IPCS ( 1 ) BUGS Things ca
- Page 360 and 361: I� �--- �� '·, }
- Page 363 and 364: KSH ( 1 ) KSH ( l ) NAME ksh - Korn
- Page 365 and 366: KSH ( 1) KSH(l) { list ; } List is
- Page 367 and 368: KSH ( 1 ) KSH(l) The value of a nam
- Page 369 and 370: KSH ( 1 ) KSH(l) emacs, gmacs, or v
- Page 371 and 372: KSH ( 1 ) KSH(l) immediately follow
- Page 373 and 374: KSH ( 1 ) KSH(l) had been) and then
- Page 375 and 376: KSH ( 1) KSH(l) The shell maintains
- Page 377 and 378: KSH( 1) KSH ( 1) 'CTRL' (control) k
- Page 379 and 380: KSH ( 1) KSH ( 1) command you are i
- Page 381 and 382: KSH ( 1 ) KSH ( 1) c Delete the cur
- Page 383 and 384: KSH ( 1 ) KSH(l) if any. If n is sp
- Page 385 and 386: KSI-I ( 1) KSH ( 1 ) + - addition,
- Page 387 and 388: KSH ( 1 ) KSH ( 1 ) keyword Same as
- Page 389 and 390: KSH ( 1) -R -Z KSH(l) parameter is
GREP ( 1) GREP (1)<br />
NAME<br />
grep, egrep, fgrep - search a file for a pattern<br />
SYNOPSIS<br />
grep [ options ] expression [ files ]<br />
egrep [ options ] [expression ] [ files ]<br />
fgrep [ options ] [ strings ] [ files ]<br />
DESCRIPTION<br />
Commands of the grep family search the input files (standard<br />
input default) for lines matching a pattern. Normally, each line<br />
found is copied to the standard output. Grep patterns are limited<br />
regular expressions in the style of ed(1); grep uses a compact<br />
non-deterministic algorithm. Egrep patterns are full regular<br />
expressions; it uses a fast deterministic algorithm that sometimes<br />
needs exponential space. Fgrep patterns are fixed strings; it is<br />
fast and compact. The following options are recognized:<br />
-v All lines but those matching are printed.<br />
-c Only a count of matching lines is printed.<br />
-i Ignore upper/lower case distinction during compare.<br />
-x (Exact) only lines matched in their entirety are printed<br />
(fgrep only).<br />
-1 Only the names of files with matching lines are listed<br />
(once), separated by new-lines.<br />
-n Each line is preceded by its relative line number in the file.<br />
-b Each line is preceded by the block number on which it was<br />
found. This is sometimes useful in locating disk block<br />
numbers by context.<br />
-s The error messages produced for nonexistent or unreadable<br />
files are suppressed (grep only).<br />
-eexpression<br />
Same as a simple expression argument, but useful when the<br />
expression begins with a-(does not work with grep ).<br />
-ffile The regular expression ( egrep) or strings list (fgrep ) is<br />
taken from the file .<br />
In all cases, the file name is output if there is more than one input<br />
file. Care should be taken when using the characters $, *, [, �, 1,<br />
( , ), and \ in expression, because they are also meaningful to the<br />
shell. It is safest to enclose the entire expression argument in single<br />
quotes 1 . . . 1 .<br />
Fgrep searches for lines that contain one of the strings separated<br />
by new-lines.<br />
Egrep accepts regular expressions as in ed(1), except for \( and \),<br />
with the addition of:<br />
1. A regular expression followed by + matches one or more<br />
occurrences of the regular expression.<br />
2. A regular expression followed by ? matches 0 or 1<br />
occurrences of the regular expression.<br />
3. Two regular expressions separated by 1 or by a new-line<br />
match strings that are matched by either.<br />
4. A regular expression may be enclosed in parentheses () for<br />
grouping<br />
- 1 -