Link to home
Start Free TrialLog in
Avatar of ivoicenetworks
ivoicenetworks

asked on

Extarcting some text from linux log file

Experts !  I am a linux newbie  . I have a large log file whcih is around 2.5 GB on a linux server. I want to search for an event  which got only few lines of text within that log file . How can I search or extract that event from that log file .
I  am afraid to open this log file with text editors like vi or nano directly from the server since it is in production. i will be in trouble if my server  freezes.
Avatar of loopfinity
loopfinity

Avatar of woolmilkporc
Assuming your event starts with someting like "Event ID 99" and ends with someting like "Event END" you can do

awk '/Event ID 99/,/Event END/' logfile

wmp
ASKER CERTIFIED SOLUTION
Avatar of woolmilkporc
woolmilkporc
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
... and there is also Perl:

perl -ne 'print if /Event ID 99/../Event END/' logfile
it would be interesting to know the timing results on such a large file from the 3 methods suggested by wmp, if you get a chance.
Avatar of ivoicenetworks

ASKER

thanks experts