Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ grep(1) — sys5 — Apollo Domain/OS SR10.4.1

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

ed(1)

egrep(1)

fgrep(1)

sed(1)

sh(1)

chrtbl(1M)

ctype(3C)

environ(5)

GREP(1)                              SysV                              GREP(1)



NAME
     grep - search a file for a pattern

SYNOPSIS
     grep [options] limited regular expression [file ...]

DESCRIPTION
     grep searches files for a pattern and prints all lines that contain that
     pattern.  grep uses limited regular expressions (expressions that have
     string values that use a subset of the possible alphanumeric and special
     characters) like those used with ed(1) to match the patterns.  It uses a
     compact non-deterministic algorithm.

     Be careful using the characters $, *, [, ^, |, (, ), and \ in the limited
     regular expression because they are also meaningful to the shell.  It is
     safest to enclose the entire limited regular expression in single quotes
     '...'.

     If no files are specified, grep assumes standard input.  Normally, each
     line found is copied to standard output.  The file name is printed before
     each line found if there is more than one input file.

OPTIONS
     -b        Precedes each line by the block number on which it was found.
               Useful in locating block numbers by context (first block is 0).

     -c        Prints only a count of the lines that contain the pattern.

     -i        Ignores upper/lower case distinction during comparisons.

     -l        Prints the names of files with matching lines once, separated
               by new-lines. Does not repeat the names of files when the
               pattern is found more than once.

     -n        Precedes each line by its line number in the file (first line
               is 1).

     -s        Suppresses error messages about nonexistent or unreadable
               files.

     -v        Prints all lines except those that contain the pattern.

FILES
     /lib/chrclass/*

DIAGNOSTICS
     Exit status is 0 if any matches are found, 1 if none, 2 for syntax errors
     or inaccessible files (even if matches were found).

NOTE
     For information on the grep user-settable character classes, see
     chrtbl(1M), ctype(3C), and environ(5).

BUGS
     Lines are limited to BUFSIZ characters; longer lines are truncated.
     BUFSIZ is defined in /usr/include/stdio.h.

     If there is a line with embedded nulls, grep only matches up to the first
     null; if that matches, it prints the entire line.

SEE ALSO
     ed(1), egrep(1), fgrep(1), sed(1), sh(1), chrtbl(1M), ctype(3C),
     environ(5).

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026