and if i'd like to place # before each line that i find?
If you want to display lines from 'errors is' to empy line with '#' at the begening of each line :
To print whole file with error lines prefixed by '#'
what you've told was great - i'm really impressed but... as it seems... i don't know exactly all the error messages (oracle), but i need to catch them all, and filter out the lines with no errors... so i've got two choices:
1. filter out the messages without errors -> "No errors ......... ^$"
2. catch all error messages - here starts the problem... i don't know all the error codes... besides i think that i can miss some, even then...
so my question is, how can i filter all lines begining with "No errors (bla bla bla) ^$" (ending with new line) + one line before it.... ofcourse i could write a C program and don't bother... but i'd like to write it all in shell... can somebody help me with this?
example oracle error (it's not strictly an error, but that doesn't matter):
and message with no errors:
Last edited by miechu; 10-02-2006 at 08:52 AM..
Reason: added example
don't really have to code in C in order to do that
Alternative in Python, which is much easier:
Input file sample:
bla bla
...
erros is 1324546
the bla bla bla
bla bla bla...
...
...
bla bla
erros is 32423423
the bla bla 1
the bla bla 2
the bla bla 3
not quite... i have noiced, that some errors have also blank line "in" them, so i ended up writing a code that will find another "Compiling " string + added line breaking (based on words) so i can add '#' in front, and each bug is spaced with "-------------------"
if anyone is interested:
but your solution is very interesting, i'm just too lame in bash to write a full script... so i eneded up mixing both...
Hi ,
I want to remove the specific pattern and remove those lines from file using shell script.
i want to remove these lines
<?xml version='1.0' encoding='UTF-8'?>
<row_set>
</row_set>
my input file has content like this.
file name: sample.xml
<?xml version='1.0'... (4 Replies)
Hi fellas,
I have a file like this:
A_B
B_D
C_D
D_B
E_F
G_H
B_A
F_E
In other words, I have member1_member2 and member2_member1 in the same file. In the exemple aforementioned I have A_B and B_A, B_D and D_B, E_F and F_E.
So, I would like to know a sript that print the lines B_A, D_B... (3 Replies)
Hi, I am new to Unix and this is my first post on this forum. I am trying to convert a file into an xml. In my input I want to search for any line that starts with a 'F' and make it a tag in the xml.
See below for the input and output.
Input :
<Payment>
<REFERENCE>78</REFERENCE>
F123 : ... (7 Replies)
Hi , i am a new with perl, i want to made a script that find in file rows that start with specil words, as an example a line will start with"
.............................................
specialword aaa=2 bbb=5
.............................................
and to put this in a new file... (3 Replies)
Hello all,
I've a problem. I've two logfiles and i need to find lines in the second file by using information from the first file. First I need to extract a searchpattern from the first file. Its like abc=searchpattern&cde=. All between abc= and &cde= is the pattern I need to find in the second... (2 Replies)
Hi,
Please take a look at the below eg. I would like to search for abc() pattern first and then search for (xyz) in the next line. If I can find the pattern, then I should delete the 3 lines.
I can only find the pattern and delete but I am unable to find two patterns and delete. Any... (8 Replies)
What is the best way to display lines in a log file that begin with a certain string?
Preferably I would like to 'print' them to a file. I guess I would use 'cat' for that?
There are two types of line I would like to get at - each begins with a different two words.
It would be something... (8 Replies)
I'm trying to search for lines ending with "}" with the following command but am not getting any output.
grep '\}$' myFile.txt
I actually want to negate this (i.e. lines not ending with "}"), but I guess that should be easier once I find the command that finds it? (11 Replies)
hi guys! I`ll really appreciate your help.
The situation is:
i have a log file, and i need to get the needed lines from it.
linecount=$(cat -n http.log | grep ALERT | awk '{print $1}' | wc -l)
lines=$(cat -n http.log | grep ALERT | awk '{print $1}')
1-string gets the number of found lines... (2 Replies)