04-22-2013
Quote:
why do we even need the A option
grep -A N prints N lines of "after-context". That means it prints the matching line, and then the next N lines. So
grep regexp -A 999999 prints the matching line and the next 999999 lines. The reason they chose six nines is they figured that was such as big number that it would print the rest of the log file, is my guess. 999999 is a very big number, in terms of number of lines for a log file. So the overall intention is to count the number of lines with
'Option=\[Yes\]' that occur AFTER the line with regexp.
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Explain the output of the command “sort -rfn file1 | more” (1 Reply)
Discussion started by: wickbc
1 Replies
2. Shell Programming and Scripting
Hi all ,
please explain the following command :
perl -e 'select(undef,undef,undef,.15)'
Thanks and Regards
Navatha (2 Replies)
Discussion started by: Navatha
2 Replies
3. UNIX for Dummies Questions & Answers
Specifically what is the purpose of sed?
What is f?
Why is the 'cp f $phonefile' line needed when the script ‘goes live'?
Why might that two commands following sed be commented out at the present time ( i.e., during development)?
Thanks in... (2 Replies)
Discussion started by: knp808
2 Replies
4. Shell Programming and Scripting
find . -type f -ctime +3 -exec mv {} /somedirectory/ \;
in particular "-ctime v/s -mtime" and "difference between +3 and -3" (5 Replies)
Discussion started by: Rambo
5 Replies
5. UNIX for Dummies Questions & Answers
Hi,
I saw this. But I don't know why we need this?
ls mydir > foo.txt ## I know what this will do, it will take the results and write to the file called foo.txt
ls mydir > foo.txt 2>&1 ## Don't know why we need 2>&1
Thanks. (2 Replies)
Discussion started by: samnyc
2 Replies
6. Shell Programming and Scripting
sed -e 's,*$,,'
Can someone explain the options in this command? (2 Replies)
Discussion started by: scj2012
2 Replies
7. Shell Programming and Scripting
Hi ,
i am new to unix i need a small clarification regarding this
sqlplus -s $USER_NAME/$PASSWD@$ORA_SID<< EOF >> SQL_CONN_LOG.log
In the above command what is the meaning of <<EOF>>
Thanks,
krishna. (2 Replies)
Discussion started by: rams_krishna
2 Replies
8. Red Hat
su - keibatch -c ""date ; /usr/local/kei/batch/apb/bin/JKEIKYK4140.sh -run "&$C$6&" WSUKE100201""
Not clear about : date ; /usr/local/kei/batch/apb/bin/JKEIKYK4140.sh -run "&$C$6&" WSUKE100201
Please help (2 Replies)
Discussion started by: honda_city
2 Replies
9. Shell Programming and Scripting
Hi Forum.
I have the following script /home/user/EDW_ENV.sh to setup some environment variables as:
##### section 1 PM_HOME #####
export PC_DIR_BASE=/data/informatica/ming
export DIR_ORACLE=/data/sw/apps/oracle/Oracle_scripts
export... (4 Replies)
Discussion started by: pchang
4 Replies
10. UNIX for Beginners Questions & Answers
I have a requirement to remove all non-ascii characters from a fixed length file. I used the below command which is removing special characters but somehow the total record length is being truncated to one space less. If it is a multi-byte string then many characters at the end are being truncated.... (8 Replies)
Discussion started by: eskay
8 Replies
LEARN ABOUT DEBIAN
plan9-grep
GREP(1) General Commands Manual GREP(1)
NAME
grep, g - search a file for a pattern
SYNOPSIS
grep [ option ... ] pattern [ file ... ]
g [ option ... ] pattern [ file ... ]
DESCRIPTION
Grep searches the input files (standard input default) for lines that match the pattern, a regular expression as defined in regexp(7) with
the addition of a newline character as an alternative (substitute for |) with lowest precedence. Normally, each line matching the pattern
is `selected', and each selected line is copied to the standard output. The options are
-c Print only a count of matching lines.
-h Do not print file name tags (headers) with output lines.
-e The following argument is taken as a pattern. This option makes it easy to specify patterns that might confuse argument parsing,
such as -n.
-i Ignore alphabetic case distinctions. The implementation folds into lower case all letters in the pattern and input before interpre-
tation. Matched lines are printed in their original form.
-l (ell) Print the names of files with selected lines; don't print the lines.
-L Print the names of files with no selected lines; the converse of -l.
-n Mark each printed line with its line number counted in its file.
-s Produce no output, but return status.
-v Reverse: print lines that do not match the pattern.
-f The pattern argument is the name of a file containing regular expressions one per line.
-b Don't buffer the output: write each output line as soon as it is discovered.
Output lines are tagged by file name when there is more than one input file. (To force this tagging, include /dev/null as a file name
argument.)
Care should be taken when using the shell metacharacters $*[^|()= and newline in pattern; it is safest to enclose the entire expression in
single quotes '...'. An expression starting with '*' will treat the rest of the expression as literal characters.
G invokes grep with -n and forces tagging of output lines by file name. If no files are listed, it searches all files matching
*.C *.b *.c *.h *.m *.cc *.java *.cgi *.pl *.py *.tex *.ms
SOURCE
/src/cmd/grep
/bin/g
SEE ALSO
ed(1), awk(1), sed(1), sam(1), regexp(7)
DIAGNOSTICS
Exit status is null if any lines are selected, or non-null when no lines are selected or an error occurs.
GREP(1)