How to grep 2 or 3 lines, one containing the text I want, and the others just below it?
Posted
by
Kaustubh P
on Ask Ubuntu
See other posts from Ask Ubuntu
or by Kaustubh P
Published on 2011-02-24T06:02:54Z
Indexed on
2011/02/24
7:32 UTC
Read the original article
Hit count: 293
This is a snapshot of error log:
06:16:29,933 ERROR EmailRMManager$:45 - Exception In get Message
com.rabbitmq.client.AlreadyClosedException: clean connection shutdown; reason: Attempt to use closed channel
at com.rabbitmq.client.impl.AMQChannel.ensureIsOpen(AMQChannel.java:195)
at com.rabbitmq.client.impl.AMQChannel.rpc(AMQChannel.java:222)
at com.rabbitmq.client.impl.AMQChannel.rpc(AMQChannel.java:208)
at com.rabbitmq.client.impl.AMQChannel.exnWrappingRpc(AMQChannel.java:139)
at com.rabbitmq.client.impl.ChannelN.basicGet(ChannelN.java:645)
I do the following command:
cat foo.log | grep ERROR
to get an OP as:
06:16:29,933 ERROR EmailRMManager$:45 - Exception In get Message
What command should I execute to get the output as
06:16:29,933 ERROR EmailRMManager$:45 - Exception In get Message
com.rabbitmq.client.AlreadyClosedException: clean connection shutdown; reason: Attempt to use closed channel
ie, also grep the line(s) after the pattern?
© Ask Ubuntu or respective owner