source: buchla-68k/orig/doc/Utilities/GREP.TXT@ 6888aa2

Last change on this file since 6888aa2 was 3ae31e9, checked in by Thomas Lopatic <thomas@…>, 8 years ago

Imported original source code.

  • Property mode set to 100755
File size: 2.3 KB
RevLine 
[3ae31e9]1grep searches a file for a given pattern. Execute by:
2
3 grep [flags] regular_expression file_list
4
5Flags are single characters preceeded by '-':
6 -c Only a count of matching lines is printed
7 -f Print file name for matching lines switch, see below
8 -n Each line is preceeded by its line number
9 -v Only print non-matching lines
10
11The file_list is a list of files.
12The file name is normally printed if there is a file given.
13The -f flag reverses this action.
14
15The regular_expression defines the pattern to search for. Upper- and
16lower-case are always ignored. Blank lines never match. The expression
17should be quoted to prevent file-name translation.
18
19x An ordinary character (not mentioned below) matches that character.
20
21'\' The backslash quotes any character. e.g. "\$" matches a dollar-sign.
22
23'^' A circumflex at the beginning of an expression matches the
24 beginning of a line.
25
26'$' A dollar-sign at the end of an expression matches the end of a line.
27
28'.' A period matches any character except "new-line".
29
30':a' A colon matches a class of characters described by the following
31':d' character. ":a" matches any alphabetic, ":d" matches digits,
32':n' ":n" matches alphanumerics, ": " matches spaces, tabs, and
33': ' other control characters, such as new-line.
34
35'*' An expression followed by an asterisk matches zero or more
36 occurrances of that expression: "fo*" matches "f", "fo", "foo", etc.
37
38'+' An expression followed by a plus sign matches one or more
39 occurrances of that expression: "fo+" matches "fo", etc.
40
41'-' An expression followed by a minus sign optionally matches
42 the expression.
43
44'[]' A string enclosed in square brackets matches any character in
45 that string, but no others. If the first character in the
46 string is a circumflex, the expression matches any character
47 except "new-line" and the characters in the string. For
48 example, "[xyz]" matches "xx" and "zyx", while "[^xyz]"
49 matches "abc" but not "axb". A range of characters may be
50 specified by two characters separated by "-". Note that,
51 [a-z] matches alphabetics, while [z-a] never matches.
52
53The concatenation of regular expressions is a regular expression.
Note: See TracBrowser for help on using the repository browser.