SED help (or AWK!)
Steve McConville
mcconville.steve at gmail.com
Wed Jan 28 11:39:43 CET 2009
Actually it's just occurred to me that you could do something like
for i in $(grep ^ORA output.log | sort | uniq) ; do grep -B 2 $i
output.log | head -n 3 ; done
2009/1/28 Steve McConville <mcconville.steve at gmail.com>:
> grep ORA | sort | uniq
>
> Will get you unique errors, but won't get you context.
>
> 2009/1/28 Longman <clug at gasops.co.uk>:
>>
>> 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 :-)
>> _______________________________________________
>> CLUG mailing list
>> clug at cambridge-lug.org
>> Website: http://www.cambridge-lug.org
>>
>
>
>
> --
> steev
> http://www.daikaiju.org.uk/~steve/
>
--
steev
http://www.daikaiju.org.uk/~steve/
More information about the CLUG
mailing list