01-13-2009
how to get lines prior to the line being searched
Hi,
Can anbody please let me know how i can retrieve lines above the line being searched in a file.
I am looking for an error message from a file, if I see that message I want the lines above that message along with this line.
how do we do this.
Please do let me know
An example which i have put here is below
System state dump is made for local instance
System State dumped to trace file /u01/app/oracle/admin/prod/bdump/prod1_diag_12767.trc
Fri Oct 3 14:47:34 2008
Trace dumping is performing id=[cdmp_20081003144734]
Fri Oct 3 14:47:34 2008
Instance terminated by PMON, pid = 12765
I am looking for the line "Instance terminated" in my script
if I recieve i want to grep lines above the searched message along with the searched message
Please do let me know
Thanks in advance
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hi all,
Would like to know how I could search for a string 'xyz' but have the output show the line plus the line above and/or below all lines found.
eg. search for xyz from file containing:
abc
12345
asdf xyz asdfds
wwwww
kjkjkj
ppppp
kkkxyz
eeee
zzzzz
and the output to... (2 Replies)
Discussion started by: sammac
2 Replies
2. Shell Programming and Scripting
Hi all.
I have a database log file in which log data get appended to it daily. I want to do a automatic maintainence of this log by going through the log and deleting lines belonging to a certain date.
How should i do it? Please help. Thanks.
Example. To delete all lines prior to Jun... (4 Replies)
Discussion started by: ahSher
4 Replies
3. Shell Programming and Scripting
It sounds a bit confusing but what I have is a text file like the example below (without the Line1, Line2, Line3 etc. of course) and I want to move every group of characters into a new line after each space.
Example of text file;
line1 .digg-widget-theme2 ul { background: rgb(0, 0, 0) none... (7 Replies)
Discussion started by: lewk
7 Replies
4. Shell Programming and Scripting
Hi all,
I didn't find anything that specifically answers this after searching for a bit, so please forgive me if this has been covered before.
I'm looking to delete all lines prior to the last occurrence of a string in a file or stream from within a shell script (bash.)
A bit of... (4 Replies)
Discussion started by: LivinFree
4 Replies
5. Shell Programming and Scripting
Hi,
I am trying to monitor alert log of oracle. i am searching based on ORA- error message
if i find the line, i want the 2 to 3 lines before search line and 2 to 3 lines after the searched line.
like for example, oracle has generated ORA7445 errors in the alert log, when i search for that... (18 Replies)
Discussion started by: bbnl
18 Replies
6. Shell Programming and Scripting
Need Assistance in shell programming... I have a huge file which has multiple stations and i wanted to search particular station and extract few lines from it and the rest is not needed
Bold letters are the stations . The whole file has multiple stations .
Below example i wanted to search... (4 Replies)
Discussion started by: ajayram_arya
4 Replies
7. Shell Programming and Scripting
Hello,
I need a program that read a file line by line and prints out lines 1, 2 & 3 after an empty line... An example of entries in the file would be:
SRVXPAPI001 ERRO JUN24 07:28:34 1775
REASON= 0000, PROCID= #E506 #1065: TPCIPPR, INDEX= 003F
... (8 Replies)
Discussion started by: Ferocci
8 Replies
8. Shell Programming and Scripting
I have been searching and trying to come up with an awk that will perform the following on a
converted text file (original is a pdf).
1. Since the first two lines are (begin with) text they are removed
2. if $1 is a number then all text is merged (combined) into one line until the next... (3 Replies)
Discussion started by: cmccabe
3 Replies
9. Shell Programming and Scripting
Hello All,
While searching for the question, I found some answers but my implementation is not giving expected output.
I have two files; one is sourcefile, other is named template.
What I want to do is to search each line in template, when found all columns, cut the matching line from source... (4 Replies)
Discussion started by: baris35
4 Replies
10. UNIX for Beginners Questions & Answers
Input file:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 (6 Replies)
Discussion started by: Sagar Singh
6 Replies
LEARN ABOUT FREEBSD
soeliminate
SOELIMINATE(1) BSD General Commands Manual SOELIMINATE(1)
NAME
soeliminate -- interpret .so directive in manpages
SYNOPSIS
soeliminate [-Crtv] [-I dir] [files ...]
DESCRIPTION
soeliminate reads files lines by lines.
If a line starts by: ``.so anotherfile'' it replace the line by processing ``anotherfile''. Otherwise the line is printed to stdout.
-C Compatibility with GNU groff's soelim(1) (does nothing).
-r Compatibility with GNU groff's soelim(1) (does nothing).
-t Compatibility with GNU groff's soelim(1) (does nothing).
-v Compatibility with GNU groff's soelim(1) (does nothing).
-I dir This option specify directories where soeliminate searches for files (both those on the command line and those named in ``.so''
directive.) This options may be specified multiple times. The directories will be searched in the order specified.
The files are always searched first in the current directory.
A file specified with an absolute path will be opened directly without performing a search.
SEE ALSO
mandoc(1), soelim(1)
BSD
November 22, 2014 BSD