Files
2024-02-19 00:21:39 -05:00

66 lines
917 B
Plaintext

Command: cgrep - grep and display context
Syntax: cgrep [-a n] [-b n] [-f] [-l n] [-n] [-w n] pattern [file]
...
Flags: -a How many lines to display after the matching line
-b How many lines to display before the matching line
-f Suppress file name in the output
-l Lines are truncated to this length before comparison
-n Suppress line numbers in the output
-w Sets window size (same as -a n -b n)
Example: cgrep -w 3 hello file1 # Print 3 lines of context each way
Cgrep is a program like grep, except that it also can print a few
lines above and/or below the matching lines. It also prints the line
numbers of the output.