Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

cgrep(1) [minix man page]

CGREP(1)						      General Commands Manual							  CGREP(1)

NAME
cgrep - grep and display context SYNOPSIS
cgrep [-a n] [-b n] [-f] [-l n] [-n] [-w n] pattern [file] ... OPTIONS
-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) EXAMPLES
cgrep -w 3 hello file1 # Print 3 lines of context each way DESCRIPTION
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. SEE ALSO
grep(1), fgrep(1). CGREP(1)

Check Out this Related Man Page

GREP(1) 						      General Commands Manual							   GREP(1)

NAME
grep - search a file for lines containing a given pattern SYNOPSIS
grep [-elnsv] pattern [file] ... OPTIONS
-e -e pattern is the same as pattern -c Print a count of lines matched -i Ignore case -l Print file names, no lines -n Print line numbers -s Status only, no printed output -v Select lines that do not match EXAMPLES
grep mouse file # Find lines in file containing mouse grep [0-9] file # Print lines containing a digit DESCRIPTION
Grep searches one or more files (by default, stdin) and selects out all the lines that match the pattern. All the regular expressions accepted by ed and mined are allowed. In addition, + can be used instead of * to mean 1 or more occurrences, ? can be used to mean 0 or 1 occurrences, and | can be used between two regular expressions to mean either one of them. Parentheses can be used for grouping. If a match is found, exit status 0 is returned. If no match is found, exit status 1 is returned. If an error is detected, exit status 2 is returned. SEE ALSO
cgrep(1), fgrep(1), sed(1), awk(9). GREP(1)
Man Page

5 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

cgrep for the most recent 15min output

I have a history file that recieves all sorts of messages 24 hours a day. I have a script that retreives various messages in the history file. There is an one multi line output that is sent to the history file that comes in every 15 minutes. How do I cgrep for the most recent 15 minute output in... (5 Replies)
Discussion started by: jojojmac5
5 Replies

2. UNIX for Dummies Questions & Answers

grep, cgrep or something close

Hi, New to this forum. Nice forum and very helpful. Quick question. I'm trying to grep a list of numbers from single digit to 3-digit. For example, I have a pool of numbers that contain two specific numbers, 17 and 177. I would like to grep for 17 but not get 177. When using grep, I also... (4 Replies)
Discussion started by: dejit
4 Replies

3. Shell Programming and Scripting

print chunk of lines only if there is a pattern match in between them

Hi All, Please find the sample file below: NAME ID NUMBER -------------------------------------------------------------------------------------------------- --------- abcdefgheija;lksdf ... (13 Replies)
Discussion started by: niel.verty
13 Replies

4. UNIX for Advanced & Expert Users

grep across multiple lines

How do you grep 'select * from table_name' string from a script if the select * and from table_name are on 2 different lines ? like select * from table_name Any help would be greatly appreciated !!! Thanks RDR (4 Replies)
Discussion started by: RDR
4 Replies

5. Shell Programming and Scripting

sed Range Pattern and 2 lines before Start Pattern

Hi all, I have been searching all over Google but I am unable to find a solution for a particular result that I am trying to achieve. Consider the following input: 1 2 3 4 5 B4Srt1--Variable-0000 B4Srt2--Variable-1111 Srt 6 7 8 9 10 End (3 Replies)
Discussion started by: y2jacky
3 Replies