SED help (or AWK!)

Longman clug at gasops.co.uk
Wed Jan 28 11:11:55 CET 2009


Hi peeps.

I want to copy a load of data from a log file that starts 'ORA-' and put
the lines into another file.  Basically I have a load of Oracle errors
in a log file and the file is very big and I am interested in only the
errors (file is 700MB but I hope that there are less than 1MB of errors!).

Example:

ERROR at line 1:
ORA-00904: "TIMESTAMP": invalid identifier

And something like ?

sed -n '/ORA/w output.log' errors.txt

But that will not give me unique errors.  Also  I'd like to have two
lines above the match (like greps -C context option) so that I can see
the SQL that failed.

Yes that's a lot of wants for a Tuesday :-)



More information about the CLUG mailing list