12-09-2011
find a word and print n lines before and after the match
how to find a word and print n lines before and after the match until a blank line is encounterd
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
I want to print all words till the last word after the match of "ERROR" word. For e.g.
I'll get an sqlplus error with
e.g. 1
$ ./calltest_fn.ksh
var test_var:=test_fn1; calltest_fn.ksh file1 file2 file3 ERROR at line 4: ORA-06550: line 4, column 11: PLS-00201: identifier... (5 Replies)
Discussion started by: dips_ag
5 Replies
2. Shell Programming and Scripting
i have a file like below. how can i printout the digits followed by the pattern -bwout and -bwin. say i run the script by entering line number 145 (the fourth line), then the o/p should be like
5000000 1024000
8 test1 -ipprot erp -ppsout 500 -ppsin 500 -bwout 300000 -bwin 300000 -statsdevice... (7 Replies)
Discussion started by: sb245
7 Replies
3. Shell Programming and Scripting
hi all, I'm new there, I'm just playing with perl and lwp and I just successfully created a script for log in to a web site with post. I have a response but I would like to have something like this:
I have in my response lines like:
<div class="sender">mimi020</div>
<some html code.....>... (3 Replies)
Discussion started by: vogueestylee
3 Replies
4. Shell Programming and Scripting
file1:
file2:
I need to find matches for any lines in file1 that appear in file2. Desired output is '>' plus the file1 term, followed by the line after the match in file2 (so the title is a little misleading):
This is honestly beyond what I can do without spending the whole night on it, so I'm... (2 Replies)
Discussion started by: pathunkathunk
2 Replies
5. Shell Programming and Scripting
Hi all,
I have the below line:
08 03 * * 1-5 XXXXXXXXXXXXX -ENVI LDNFOUAT10 -EXE xxxxxxxx -CONFIG \${xxxxx} -SUBCLASS RESET -START -EXTRAAPPARGS \" -env 38LDNFOUAT10 \" >> /tmp/SRRC_xxxxxxx_start.log.`/usr/bin/date +\%Y\%m\%d` 2>&1
I want to print just one word after the string "-env", in... (7 Replies)
Discussion started by: Cvg
7 Replies
6. Shell Programming and Scripting
Hi,
I have the logs :
cat logsx.txt
744906,{"reportingGroups":,"version":"2.0"}
678874,{"reportingGroups":,"version":"2.0"}
193571,{"reportingGroups":,"version":"2.0"}
811537,{"reportingGroups":,"version":"2.0"}
772024,{"reportingGroups":,"version":"2.0"}... (5 Replies)
Discussion started by: justbow
5 Replies
7. Shell Programming and Scripting
Below is the file
DISK-A 109063.2 49 31 40.79
DISK-B 110058.5 49 44 57.07
DISK-c 4402.4 2 1 2.14
from the file, i want to search for 'DISK-A' and print only that line with the first word matching to DISK-A and the output should skip DISK-A.
Desired Output: (If i'm... (2 Replies)
Discussion started by: web2moha
2 Replies
8. UNIX for Dummies Questions & Answers
URGENT HELP IS NEEDED!!
I am looking to move matching lines (01 - 07) from File1 and 77 tab the matching string from File2, to File3.txt. I am almost done but
- Currently, script is not printing lines to File3.txt in order.
- Also the matching lines are not moving out of File1.txt
... (1 Reply)
Discussion started by: High-T
1 Replies
9. Shell Programming and Scripting
Hello,
I have a file contains two columns. I need to print the lines after “xxx” so i'm trying to match "xxx" & cut the lines after that. I'm trying with the grep & cut command, if there any simple way to extract this please help me.
Sample file :
name id
AAA 123
AAB 124
AAC 125... (4 Replies)
Discussion started by: Shenbaga.d
4 Replies
10. UNIX for Beginners Questions & Answers
Guys i need an idea for one logic..in shell scripting am struggling with a logic...So the thing is... i need to search for a word in a huge log file and i need to continue to print few more lines from that line and the consecutive line has to end when it finds the line with date..because i know... (1 Reply)
Discussion started by: Prathi
1 Replies
AID(1) User Commands AID(1)
NAME
aid - Query ID database and report results.
SYNOPSIS
aid [OPTION]... PATTERN...
DESCRIPTION
Query ID database and report results. By default, output consists of multiple lines, each line containing the matched identifier followed
by the list of file names in which it occurs.
-f, --file=FILE
file name of ID database
-i, --ignore-case
match PATTERN case insensitively
-l, --literal
match PATTERN as a literal string
-r, --regexp
match PATTERN as a regular expression
-w, --word
match PATTERN as a delimited word
-s, --substring
match PATTERN as a substring
Note: If PATTERN contains extended regular expression metacharacters, it is interpreted as a regular expression substring. Other-
wise, PATTERN is interpreted as a literal word.
-k, --key=STYLE
STYLE is one of `token', `pattern' or `none'
-R, --result=STYLE
STYLE is one of `filenames', `grep', `edit' or `none'
-S, --separator=STYLE
STYLE is one of `braces', `space' or `newline' and only applies to file names when `--result=filenames'
The above STYLE options control how query results are presented. Defaults are --key=token --result=filenames --separator=space
-F, --frequency=FREQ
find tokens that occur FREQ times, where FREQ is a range expressed as `N..M'. If N is omitted, it defaults to 1, if M is omitted it
defaults to MAX_USHRT
-a, --ambiguous=LEN
find tokens whose names are ambiguous for LEN chars
-x, --hex
only find numbers expressed as hexadecimal
-d, --decimal
only find numbers expressed as decimal
-o, --octal
only find numbers expressed as octal
By default, searches match numbers of any radix.
--help display this help and exit
--version
output version information and exit
REPORTING BUGS
Report bugs to bug-idutils@gnu.org
SEE ALSO
The full documentation for aid is maintained as a Texinfo manual. If the info and aid programs are properly installed at your site, the
command
info aid
should give you access to the complete manual.
aid - 4.5 August 2010 AID(1)