hbase

heirloom base
git clone git://git.2f30.org/hbase
Log | Files | Refs | README

egrep.1 (11187B)


      1 '\" t
      2 .\" Sccsid @(#)egrep.1	1.42 (gritter) 8/14/05
      3 .\" Parts taken from grep(1), Unix 7th edition:
      4 .\" Copyright(C) Caldera International Inc. 2001-2002. All rights reserved.
      5 .\"
      6 .\" Redistribution and use in source and binary forms, with or without
      7 .\" modification, are permitted provided that the following conditions
      8 .\" are met:
      9 .\"   Redistributions of source code and documentation must retain the
     10 .\"    above copyright notice, this list of conditions and the following
     11 .\"    disclaimer.
     12 .\"   Redistributions in binary form must reproduce the above copyright
     13 .\"    notice, this list of conditions and the following disclaimer in the
     14 .\"    documentation and/or other materials provided with the distribution.
     15 .\"   All advertising materials mentioning features or use of this software
     16 .\"    must display the following acknowledgement:
     17 .\"      This product includes software developed or owned by Caldera
     18 .\"      International, Inc.
     19 .\"   Neither the name of Caldera International, Inc. nor the names of
     20 .\"    other contributors may be used to endorse or promote products
     21 .\"    derived from this software without specific prior written permission.
     22 .\"
     23 .\" USE OF THE SOFTWARE PROVIDED FOR UNDER THIS LICENSE BY CALDERA
     24 .\" INTERNATIONAL, INC. AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR
     25 .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
     26 .\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     27 .\" ARE DISCLAIMED. IN NO EVENT SHALL CALDERA INTERNATIONAL, INC. BE
     28 .\" LIABLE FOR ANY DIRECT, INDIRECT INCIDENTAL, SPECIAL, EXEMPLARY, OR
     29 .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     30 .\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
     31 .\" BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
     32 .\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
     33 .\" OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
     34 .\" EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     35 .TH EGREP 1 "8/14/05" "Heirloom Toolchest" "User Commands"
     36 .SH NAME
     37 egrep \- search a file for a pattern using full regular expressions
     38 .SH SYNOPSIS
     39 .HP
     40 .ad l
     41 .nh
     42 \fB/usr/5bin/egrep\fR [\fB\-e\fI\ pattern_list\fR\ ...]
     43 [\fB\-f\fI\ pattern_file\fR] [\fB\-bchilnrRvz\fR]
     44 [\fIpattern_list\fR] [\fIfile\fR\ ...]
     45 .HP
     46 .ad l
     47 .PD 0
     48 \fB/usr/5bin/posix/egrep\fR \fB\-e\fI\ pattern_list\fR\ ...
     49 [\fB\-f\fI\ pattern_file\fR] [\fB\-c\fR|\fB\-l\fR|\fB\-q\fR]
     50 [\fB\-bhinrRsvxz\fR] [\fIfile\fR\ ...]
     51 .HP
     52 .ad l
     53 \fB/usr/5bin/posix/egrep\fR \fB\-f\fI\ pattern_file\fR
     54 [\fB\-e\fI\ pattern_list\fR\ ...] [\fB\-c\fR|\fB\-l\fR|\fB\-q\fR]
     55 [\fB\-bhinrRsvxz\fR] [\fIfile\fR\ ...]
     56 .HP
     57 .ad l
     58 \fB/usr/5bin/posix/egrep\fR [\fB\-c\fR|\fB\-l\fR|\fB\-q\fR] [\fB\-bhinsrRvxz\fR]
     59 \fIpattern_list\fR [\fIfile\fR\ ...]
     60 .br
     61 .PD
     62 .ad b
     63 .hy 1
     64 .SH DESCRIPTION
     65 The
     66 .B egrep
     67 command searches the lines of the specified files
     68 (or of standard input)
     69 for occurrences of
     70 .I pattern.
     71 The default behavior is to print each matching line to standard output.
     72 .PP
     73 The
     74 .B /usr/5bin/egrep
     75 command accepts full regular expressions;
     76 it uses a deterministic algorithm with moderate space requirements.
     77 .PP
     78 The
     79 .B /usr/5bin/posix/egrep
     80 command accepts extended regular expressions.
     81 It uses a deterministic algorithm with moderate space requirements
     82 unless the expression includes multi-character collating elements,
     83 which cause the use of a nondeterministic algorithm.
     84 .PP
     85 .B /usr/5bin/s42/egrep
     86 and
     87 .B /usr/5bin/posix2001/egrep
     88 are identical to
     89 .BR /usr/5bin/posix/egrep .
     90 .SS "Full Regular Expressions"
     91 .PP
     92 In the following description `character' excludes
     93 newline:
     94 .IP 1.
     95 A \fB\e\fR followed by a single character
     96 matches that character.
     97 .IP 2.
     98 The character \fB^\fR
     99 (\fB$\fR) matches the beginning (end) of a line
    100 as an \fIanchor\fR.
    101 .IP 3.
    102 A 
    103 .B .\&
    104 matches any character.
    105 .IP 4.
    106 A single character not otherwise endowed with special
    107 meaning matches that character.
    108 .IP 5.
    109 A string enclosed in brackets \fB[\|]\fR
    110 forms a \fIbracket expression\fR that
    111 matches any single character from the string.
    112 Ranges of ASCII character codes may be abbreviated
    113 as in `\fIa\fB\-\fIz0\fB\-\fI9\fR'.
    114 A ]
    115 may occur only as the first character of the string.
    116 A literal \- must be placed where it can't be
    117 mistaken as a range indicator.
    118 .IP 6.
    119 A regular expression followed by \fB*\fR (\fB+\fR, \fB?\fR) matches a sequence
    120 of 0 or more (1 or more, 0 or 1)
    121 matches of the regular expression.
    122 .IP 7.
    123 Two regular expressions concatenated
    124 match a match of the first followed by a match of 
    125 the second.
    126 .IP 8.
    127 Two regular expressions separated by \fB|\fR or newline
    128 match either a match for the first or a match for the
    129 second (\fIalternation\fR).
    130 .IP 9.
    131 A regular expression enclosed in parentheses \fB(\|)\fR
    132 matches a match for the regular expression (\fIgrouping\fR).
    133 .LP
    134 The order of precedence of operators
    135 is [\|] then (\|) then
    136 *+? then concatenation then | and newline.
    137 .SS "Extended Regular Expressions"
    138 Extended Regular Expressions add the following features
    139 to Full Regular Expressions:
    140 .IP 10.
    141 A regular expression
    142 followed by \fB{\fIm\fB,\fIn\fB}\fR
    143 forms an \fIinterval expression\fR that
    144 matches a sequence of \fIm\fR through \fIn\fR matches, inclusive,
    145 of the regular expression.
    146 The values of \fIm\fR and \fIn\fR must be non-negative
    147 and smaller than 255.
    148 The form \fB{\fIm\fB}\fR matches exactly \fIm\fR occurrences,
    149 \fB{\fIm\fB,}\fR matches at least \fIm\fR occurrences.
    150 .IP 11.
    151 In bracket expressions as described in 5.,
    152 the following character sequences are considered special:
    153 .IP
    154 Character class expressions of the form
    155 \fB[:\fIclass\fB:]\fR.
    156 In the C LC_CTYPE locale,
    157 the classes
    158 .sp
    159 .TS
    160 l l l l.
    161 [:alnum:]	[:cntrl:]	[:lower:]	[:space:]
    162 [:alpha:]	[:digit:]	[:print:]	[:upper:]
    163 [:blank:]	[:graph:]	[:punct:]	[:xdigit:]
    164 .TE
    165 .sp
    166 are recognized;
    167 further locale-specific classes may be available.
    168 A character class expression matches any character
    169 that belongs to the given class in the current LC_CTYPE locale.
    170 .IP
    171 Collating symbol expressions of the form
    172 \fB[.\fIc\fB.]\fR,
    173 where \fIc\fR is a collating symbol
    174 in the current LC_COLLATE locale.
    175 A collating symbol expression
    176 matches the specified collating symbol.
    177 .IP
    178 Equivalence class expressions of the form
    179 \fB[=\fIc\fB=]\fR,
    180 where \fIc\fR is a collating symbol
    181 in the current LC_COLLATE locale.
    182 An equivalence class expression
    183 matches any character that has the same collating weight
    184 as \fIc\fR.
    185 .LP
    186 The order of precedence of operators
    187 is [=\|=] [:\|:] [.\|.]
    188 then [\|]
    189 then (\|)
    190 then *+? {m,n}
    191 then concatenation
    192 then ^ $
    193 then | and newline.
    194 .PP
    195 Care should be taken when using the characters
    196 $ * [ ^ | ? \' " ( ) and \e in the expression
    197 as they are also meaningful to the Shell.
    198 It is safest to enclose the entire expression
    199 argument in single quotes \' \'.
    200 .PP
    201 Both
    202 .B /usr/5bin/egrep
    203 and
    204 .B /usr/5bin/posix/egrep
    205 accept the following options:
    206 .TP
    207 .B \-b
    208 Each line is preceded by the block number on which it was found.
    209 This is sometimes useful
    210 in locating disk block numbers by context.
    211 Block numbers start with 0.
    212 .TP
    213 .B \-c
    214 Only a count of matching lines is printed.
    215 .TP
    216 .BI \-e\  pattern_list
    217 Specifies one or more patterns, separated by newline characters.
    218 A line is selected if one or more of the specified patterns are found.
    219 .TP
    220 .BI \-f\  pattern_file
    221 One or more patterns, separated by newline
    222 characters, are read from
    223 .I pattern_file.
    224 If multiple
    225 .B \-e
    226 or
    227 .B \-f
    228 options are supplied to
    229 .BR /usr/5bin/posix/egrep ,
    230 all of the pattern lists will be evaluated.
    231 .TP
    232 .B \-h
    233 Normally, the name of each input file is printed before a match
    234 if there is more that one input file.
    235 When this option is present, no file names are printed.
    236 .TP
    237 .B \-i
    238 Upper- and lowercase differences are ignored when searching matches.
    239 .TP
    240 .B \-l
    241 The names of files with matching lines are listed
    242 (once) separated by newlines.
    243 .TP
    244 .B \-n
    245 Each line is preceded by its line number in the file.
    246 Line numbers start with 1.
    247 .TP
    248 .B \-v
    249 All lines but those matching are printed.
    250 .PP
    251 The following options are supported by
    252 .B /usr/5bin/posix/egrep
    253 only:
    254 .TP
    255 .B \-q
    256 Do not write anything to standard output.
    257 .TP
    258 .B \-s
    259 Error messages for nonexistent or unreadable files are suppressed.
    260 .TP
    261 .B \-x
    262 Consider only lines consisting of the pattern as a whole,
    263 like a regular expression surrounded by
    264 .I ^
    265 and
    266 .I $.
    267 .PP
    268 The following options are supported as extensions:
    269 .TP
    270 .B \-r
    271 With this option given,
    272 .I egrep
    273 does not directly search in each given file that is a directory,
    274 but descends it recursively
    275 and scans each regular file found below it.
    276 Device files are ignored.
    277 Symbolic links are followed.
    278 .TP
    279 .B \-R
    280 Operates recursively as with the
    281 .I \-r
    282 option,
    283 but does not follow symbolic links that point to directories
    284 unless if they are explicitly specified as arguments.
    285 .TP
    286 .B \-z
    287 If an input file is found to be compressed with
    288 .IR compress (1),
    289 .IR gzip (1),
    290 or
    291 .IR bzip2 (1),
    292 the appropriate compression program is started,
    293 and
    294 .I egrep
    295 searches for the pattern in its output.
    296 .SH "ENVIRONMENT VARIABLES"
    297 .TP
    298 .BR LANG ", " LC_ALL
    299 See
    300 .IR locale (7).
    301 .TP
    302 .B LC_COLLATE
    303 Affects the collation order for range expressions,
    304 equivalence classes, and collation symbols
    305 in extended regular expressions.
    306 .TP
    307 .B LC_CTYPE
    308 Determines the mapping of bytes to characters
    309 in both full and extended regular expressions,
    310 the availability and composition of character classes
    311 in extended regular expressions,
    312 and the case mapping for the
    313 .B \-i
    314 option.
    315 .SH "SEE ALSO"
    316 ed(1),
    317 fgrep(1),
    318 grep(1),
    319 sed(1),
    320 locale(7)
    321 .SH DIAGNOSTICS
    322 Exit status is 0 if any matches are found,
    323 1 if none, 2 for syntax errors or inaccessible files.
    324 .SH NOTES
    325 If a line contains a
    326 .SM NUL
    327 character,
    328 only matches up to this character are found with
    329 .BR /usr/5bin/posix/egrep .
    330 The entire matching line will be printed.
    331 .PP
    332 The LC_COLLATE variable has currently no effect.
    333 Ranges in bracket expressions are ordered
    334 as byte values in single-byte locales
    335 and as wide character values in multibyte locales;
    336 equivalence classes match the given character only,
    337 and multi-character collating elements are not available.
    338 .PP
    339 For portable programs, restrict textual data
    340 to the US-ASCII character set,
    341 set the LC_CTYPE and LC_COLLATE variables to `C' or `POSIX',
    342 and use the constructs in the second column
    343 instead of the character class expressions as follows:
    344 .RS 
    345 .sp
    346 .TS
    347 l l.
    348 [[:alnum:]]	[0\-9A\-Za\-z]
    349 [[:alpha:]]	[A\-Za\-z]
    350 [[:blank:]]	[\fI<tab><space>\fR]
    351 [[:cntrl:]]	[^\fI<space>\fR\-~]
    352 [[:digit:]]	[0\-9]
    353 [[:graph:]]	[!\-~]
    354 [[:lower:]]	[a\-z]
    355 [[:print:]]	[\fI<space>\fR\-~]
    356 [[:punct:]]	[!\-/:\-@[\-`{\-~]
    357 [[:space:]]	[\fI<tab><vt><ff><cr><space>\fR]
    358 [[:upper:]]	[A\-Z]
    359 [[:xdigit:]]	[0\-9a\-fA\-F]
    360 .TE
    361 .sp
    362 .RE
    363 .IR <tab> ,
    364 .IR <space> ,
    365 .IR <vt> ,
    366 .IR <ff> ,
    367 and
    368 .I <cr>
    369 indicate inclusion of
    370 a literal tabulator, space, vertical tabulator, formfeed,
    371 or carriage return character, respectively.
    372 Do not put the
    373 .IR <vt> ,
    374 .IR <ff> ,
    375 and
    376 .I <cr>
    377 characters into the range expression for the
    378 .I space
    379 class unless you actually want to match these characters.
    380 .PP
    381 Interval expressions were newly introduced
    382 with extended regular expressions
    383 and cannot be used in portable programs.
    384 To put a literal
    385 .RB ` { '
    386 character into an expression,
    387 use
    388 .IR [{] .