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

fmlgrep(1F)							   FMLI Commands						       fmlgrep(1F)

NAME
fmlgrep - search a file for a pattern SYNOPSIS
fmlgrep [-b] [-c] [-i] [-l] [-n] [-s] [-v] limited_regular_expression [filename...] DESCRIPTION
fmlgrep searches filename for a pattern and prints all lines that contain that pattern. fmlgrep uses limited regular expressions (expres- sions that have string values that use a subset of the possible alphanumeric and special characters) like those described on the regexp(5) manual page to match the patterns. It uses a compact non-deterministic algorithm. Be careful when using FMLI special characters (for instance, $, `, ', ") in limited_regular_expression. It is safest to enclose the entire limited_regular_expression in single quotes ' ... '. If filename is not specified, fmlgrep assumes standard input. Normally, each line matched is copied to standard output. The file name is printed before each line matched if there is more than one input file. OPTIONS
The following options are supported: -b Precede each line by the block number on which it was found. This can be useful in locating block numbers by context (first block is 0). -c Print only a count of the lines that contain the pattern. -i Ignore upper/lower case distinction during comparisons. -l Print only the names of files with matching lines, separated by new-lines. Does not repeat the names of files when the pattern is found more than once. -n Precede each line by its line number in the file (first line is 1). -s Suppress error messages about nonexistent or unreadable files. -v Print all lines except those that contain the pattern. EXIT STATUS
The following exit values are returned: 0 if the pattern is found (that is, TRUE) 1 if the pattern is not found (that is, FALSE) 2 if an invalid expression was used or filename is inaccessible ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWcsu | +-----------------------------+-----------------------------+ SEE ALSO
egrep(1), fgrep(1), fmlcut(1F), grep(1), attributes(5), regexp(5) NOTES
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, fmlgrep will only match up to the first null; if it matches, it will print the entire line. SunOS 5.10 28 Mar 1995 fmlgrep(1F)
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