grep N lines after match
Clash Royale CLAN TAG#URR8PPP
up vote
1
down vote
favorite
I am looking for a command where I can grep 20 or more lines after a specific match.
Example: grep "09:55:21,651" mylog_file.log
2018-02-26 09:55:21,651 ERROR [WebContainer : 0] (CommonAction.java:253) - SITAConnector Error: Empty SITA Response XML
com.ac.ccaswitch.exception.SitaConnectorException: Empty SITA Response XML
at com.ac.ccaswitch.connector.sita.SITAConnector.sendToSitaQueue(SITAConnector.java:144)
at com.ac.ccaswitch.entry.CommonAction.performTask(CommonAction.java:212)
at com.ac.ccaswitch.entry.PaymentServlet.doPost(PaymentServlet.java:85)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:738)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1694)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:970)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:508)
at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:181)
at com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:91)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:878)
at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1592)
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:191)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:454)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:516)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:307)
at com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:84)
at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:175)
at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)
at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204)
at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775)
text-processing grep
add a comment |Â
up vote
1
down vote
favorite
I am looking for a command where I can grep 20 or more lines after a specific match.
Example: grep "09:55:21,651" mylog_file.log
2018-02-26 09:55:21,651 ERROR [WebContainer : 0] (CommonAction.java:253) - SITAConnector Error: Empty SITA Response XML
com.ac.ccaswitch.exception.SitaConnectorException: Empty SITA Response XML
at com.ac.ccaswitch.connector.sita.SITAConnector.sendToSitaQueue(SITAConnector.java:144)
at com.ac.ccaswitch.entry.CommonAction.performTask(CommonAction.java:212)
at com.ac.ccaswitch.entry.PaymentServlet.doPost(PaymentServlet.java:85)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:738)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1694)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:970)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:508)
at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:181)
at com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:91)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:878)
at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1592)
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:191)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:454)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:516)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:307)
at com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:84)
at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:175)
at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)
at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204)
at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775)
text-processing grep
sed
orawk
should be able to do this.
â SabreWolfy
Feb 27 at 5:33
you can find the answer in this cross site duplicate ;) stackoverflow.com/questions/17908555/â¦
â Sundeep
Feb 27 at 5:58
add a comment |Â
up vote
1
down vote
favorite
up vote
1
down vote
favorite
I am looking for a command where I can grep 20 or more lines after a specific match.
Example: grep "09:55:21,651" mylog_file.log
2018-02-26 09:55:21,651 ERROR [WebContainer : 0] (CommonAction.java:253) - SITAConnector Error: Empty SITA Response XML
com.ac.ccaswitch.exception.SitaConnectorException: Empty SITA Response XML
at com.ac.ccaswitch.connector.sita.SITAConnector.sendToSitaQueue(SITAConnector.java:144)
at com.ac.ccaswitch.entry.CommonAction.performTask(CommonAction.java:212)
at com.ac.ccaswitch.entry.PaymentServlet.doPost(PaymentServlet.java:85)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:738)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1694)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:970)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:508)
at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:181)
at com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:91)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:878)
at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1592)
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:191)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:454)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:516)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:307)
at com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:84)
at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:175)
at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)
at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204)
at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775)
text-processing grep
I am looking for a command where I can grep 20 or more lines after a specific match.
Example: grep "09:55:21,651" mylog_file.log
2018-02-26 09:55:21,651 ERROR [WebContainer : 0] (CommonAction.java:253) - SITAConnector Error: Empty SITA Response XML
com.ac.ccaswitch.exception.SitaConnectorException: Empty SITA Response XML
at com.ac.ccaswitch.connector.sita.SITAConnector.sendToSitaQueue(SITAConnector.java:144)
at com.ac.ccaswitch.entry.CommonAction.performTask(CommonAction.java:212)
at com.ac.ccaswitch.entry.PaymentServlet.doPost(PaymentServlet.java:85)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:738)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1694)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:970)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:508)
at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:181)
at com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:91)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:878)
at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1592)
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:191)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:454)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:516)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:307)
at com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:84)
at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:175)
at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)
at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204)
at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775)
text-processing grep
edited Feb 27 at 4:28
ñÃÂsýù÷
14.9k82462
14.9k82462
asked Feb 27 at 4:05
Madhuraj
61
61
sed
orawk
should be able to do this.
â SabreWolfy
Feb 27 at 5:33
you can find the answer in this cross site duplicate ;) stackoverflow.com/questions/17908555/â¦
â Sundeep
Feb 27 at 5:58
add a comment |Â
sed
orawk
should be able to do this.
â SabreWolfy
Feb 27 at 5:33
you can find the answer in this cross site duplicate ;) stackoverflow.com/questions/17908555/â¦
â Sundeep
Feb 27 at 5:58
sed
or awk
should be able to do this.â SabreWolfy
Feb 27 at 5:33
sed
or awk
should be able to do this.â SabreWolfy
Feb 27 at 5:33
you can find the answer in this cross site duplicate ;) stackoverflow.com/questions/17908555/â¦
â Sundeep
Feb 27 at 5:58
you can find the answer in this cross site duplicate ;) stackoverflow.com/questions/17908555/â¦
â Sundeep
Feb 27 at 5:58
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
3
down vote
you can use grep's -An switch to get n lines after the match so for your example that would be
grep -A20 "09:55:21,651" mylog_file.log
EDIT:
It looks like your version of grep does not support -A.
So here is a small script you can use instead
#!/bin/sh
file="$1"
pattern="$2"
n="$3"
matches="$(grep -n $pattern $file)"
echo "$matches" | while read match; do
line="$match%%:*"
sed -n "$line,$(($line + $n - 1))p" < "$file"
done
you can use it like this: sh script.sh mylog_file.log "09:55:21,651" 20
EDIT2: While I am at it here is a solution that uses head and tail instead of sed just in case your sed is weird aswell
#!/bin/sh
file="$1"
pattern="$2"
n="$3"
matches="$(grep -n $pattern $file)"
echo "$matches" | while read match; do
line="$match%%:*"
head "-$(($line + $n - 1))" "$file" | tail "-$n"
done
This is not working. I am getting this help content - abbcd@acsayul000012:/opt/logs$ grep -A 20 "09:55:21,651" CCASWITCH.log grep: illegal option -- A usage: grep [-r] [-R] [-H] [-L] [-E|-F] [-c|-l|-q] [-insvxbhwyu] [-p[parasep]] -e pattern_list... [-f pattern_file...] [file...] usage: grep [-E|-F] [-c|-l|-q] [-insvxbhwyu] [-p[parasep]] [-e pattern_list...] -f pattern_file... [file...] usage: grep [-E|-F] [-c|-l|-q] [-insvxbhwyu] [-p[parasep]] pattern_list [file...] abbcd@acsayul000012:/opt/logs$
â Madhuraj
Feb 27 at 4:30
what version of grep are you using?
â Captain Wobbles
Feb 27 at 4:35
How to check the version of grep?
â Madhuraj
Feb 27 at 4:45
grep --version or grep -V
â Captain Wobbles
Feb 27 at 5:04
1
ok from the error message i am guessing that you are running a solaris system. You can either install gnu grep which does support -A or try the script i edited in
â Captain Wobbles
Feb 27 at 5:20
 |Â
show 1 more comment
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
3
down vote
you can use grep's -An switch to get n lines after the match so for your example that would be
grep -A20 "09:55:21,651" mylog_file.log
EDIT:
It looks like your version of grep does not support -A.
So here is a small script you can use instead
#!/bin/sh
file="$1"
pattern="$2"
n="$3"
matches="$(grep -n $pattern $file)"
echo "$matches" | while read match; do
line="$match%%:*"
sed -n "$line,$(($line + $n - 1))p" < "$file"
done
you can use it like this: sh script.sh mylog_file.log "09:55:21,651" 20
EDIT2: While I am at it here is a solution that uses head and tail instead of sed just in case your sed is weird aswell
#!/bin/sh
file="$1"
pattern="$2"
n="$3"
matches="$(grep -n $pattern $file)"
echo "$matches" | while read match; do
line="$match%%:*"
head "-$(($line + $n - 1))" "$file" | tail "-$n"
done
This is not working. I am getting this help content - abbcd@acsayul000012:/opt/logs$ grep -A 20 "09:55:21,651" CCASWITCH.log grep: illegal option -- A usage: grep [-r] [-R] [-H] [-L] [-E|-F] [-c|-l|-q] [-insvxbhwyu] [-p[parasep]] -e pattern_list... [-f pattern_file...] [file...] usage: grep [-E|-F] [-c|-l|-q] [-insvxbhwyu] [-p[parasep]] [-e pattern_list...] -f pattern_file... [file...] usage: grep [-E|-F] [-c|-l|-q] [-insvxbhwyu] [-p[parasep]] pattern_list [file...] abbcd@acsayul000012:/opt/logs$
â Madhuraj
Feb 27 at 4:30
what version of grep are you using?
â Captain Wobbles
Feb 27 at 4:35
How to check the version of grep?
â Madhuraj
Feb 27 at 4:45
grep --version or grep -V
â Captain Wobbles
Feb 27 at 5:04
1
ok from the error message i am guessing that you are running a solaris system. You can either install gnu grep which does support -A or try the script i edited in
â Captain Wobbles
Feb 27 at 5:20
 |Â
show 1 more comment
up vote
3
down vote
you can use grep's -An switch to get n lines after the match so for your example that would be
grep -A20 "09:55:21,651" mylog_file.log
EDIT:
It looks like your version of grep does not support -A.
So here is a small script you can use instead
#!/bin/sh
file="$1"
pattern="$2"
n="$3"
matches="$(grep -n $pattern $file)"
echo "$matches" | while read match; do
line="$match%%:*"
sed -n "$line,$(($line + $n - 1))p" < "$file"
done
you can use it like this: sh script.sh mylog_file.log "09:55:21,651" 20
EDIT2: While I am at it here is a solution that uses head and tail instead of sed just in case your sed is weird aswell
#!/bin/sh
file="$1"
pattern="$2"
n="$3"
matches="$(grep -n $pattern $file)"
echo "$matches" | while read match; do
line="$match%%:*"
head "-$(($line + $n - 1))" "$file" | tail "-$n"
done
This is not working. I am getting this help content - abbcd@acsayul000012:/opt/logs$ grep -A 20 "09:55:21,651" CCASWITCH.log grep: illegal option -- A usage: grep [-r] [-R] [-H] [-L] [-E|-F] [-c|-l|-q] [-insvxbhwyu] [-p[parasep]] -e pattern_list... [-f pattern_file...] [file...] usage: grep [-E|-F] [-c|-l|-q] [-insvxbhwyu] [-p[parasep]] [-e pattern_list...] -f pattern_file... [file...] usage: grep [-E|-F] [-c|-l|-q] [-insvxbhwyu] [-p[parasep]] pattern_list [file...] abbcd@acsayul000012:/opt/logs$
â Madhuraj
Feb 27 at 4:30
what version of grep are you using?
â Captain Wobbles
Feb 27 at 4:35
How to check the version of grep?
â Madhuraj
Feb 27 at 4:45
grep --version or grep -V
â Captain Wobbles
Feb 27 at 5:04
1
ok from the error message i am guessing that you are running a solaris system. You can either install gnu grep which does support -A or try the script i edited in
â Captain Wobbles
Feb 27 at 5:20
 |Â
show 1 more comment
up vote
3
down vote
up vote
3
down vote
you can use grep's -An switch to get n lines after the match so for your example that would be
grep -A20 "09:55:21,651" mylog_file.log
EDIT:
It looks like your version of grep does not support -A.
So here is a small script you can use instead
#!/bin/sh
file="$1"
pattern="$2"
n="$3"
matches="$(grep -n $pattern $file)"
echo "$matches" | while read match; do
line="$match%%:*"
sed -n "$line,$(($line + $n - 1))p" < "$file"
done
you can use it like this: sh script.sh mylog_file.log "09:55:21,651" 20
EDIT2: While I am at it here is a solution that uses head and tail instead of sed just in case your sed is weird aswell
#!/bin/sh
file="$1"
pattern="$2"
n="$3"
matches="$(grep -n $pattern $file)"
echo "$matches" | while read match; do
line="$match%%:*"
head "-$(($line + $n - 1))" "$file" | tail "-$n"
done
you can use grep's -An switch to get n lines after the match so for your example that would be
grep -A20 "09:55:21,651" mylog_file.log
EDIT:
It looks like your version of grep does not support -A.
So here is a small script you can use instead
#!/bin/sh
file="$1"
pattern="$2"
n="$3"
matches="$(grep -n $pattern $file)"
echo "$matches" | while read match; do
line="$match%%:*"
sed -n "$line,$(($line + $n - 1))p" < "$file"
done
you can use it like this: sh script.sh mylog_file.log "09:55:21,651" 20
EDIT2: While I am at it here is a solution that uses head and tail instead of sed just in case your sed is weird aswell
#!/bin/sh
file="$1"
pattern="$2"
n="$3"
matches="$(grep -n $pattern $file)"
echo "$matches" | while read match; do
line="$match%%:*"
head "-$(($line + $n - 1))" "$file" | tail "-$n"
done
edited Feb 27 at 5:39
answered Feb 27 at 4:09
Captain Wobbles
1565
1565
This is not working. I am getting this help content - abbcd@acsayul000012:/opt/logs$ grep -A 20 "09:55:21,651" CCASWITCH.log grep: illegal option -- A usage: grep [-r] [-R] [-H] [-L] [-E|-F] [-c|-l|-q] [-insvxbhwyu] [-p[parasep]] -e pattern_list... [-f pattern_file...] [file...] usage: grep [-E|-F] [-c|-l|-q] [-insvxbhwyu] [-p[parasep]] [-e pattern_list...] -f pattern_file... [file...] usage: grep [-E|-F] [-c|-l|-q] [-insvxbhwyu] [-p[parasep]] pattern_list [file...] abbcd@acsayul000012:/opt/logs$
â Madhuraj
Feb 27 at 4:30
what version of grep are you using?
â Captain Wobbles
Feb 27 at 4:35
How to check the version of grep?
â Madhuraj
Feb 27 at 4:45
grep --version or grep -V
â Captain Wobbles
Feb 27 at 5:04
1
ok from the error message i am guessing that you are running a solaris system. You can either install gnu grep which does support -A or try the script i edited in
â Captain Wobbles
Feb 27 at 5:20
 |Â
show 1 more comment
This is not working. I am getting this help content - abbcd@acsayul000012:/opt/logs$ grep -A 20 "09:55:21,651" CCASWITCH.log grep: illegal option -- A usage: grep [-r] [-R] [-H] [-L] [-E|-F] [-c|-l|-q] [-insvxbhwyu] [-p[parasep]] -e pattern_list... [-f pattern_file...] [file...] usage: grep [-E|-F] [-c|-l|-q] [-insvxbhwyu] [-p[parasep]] [-e pattern_list...] -f pattern_file... [file...] usage: grep [-E|-F] [-c|-l|-q] [-insvxbhwyu] [-p[parasep]] pattern_list [file...] abbcd@acsayul000012:/opt/logs$
â Madhuraj
Feb 27 at 4:30
what version of grep are you using?
â Captain Wobbles
Feb 27 at 4:35
How to check the version of grep?
â Madhuraj
Feb 27 at 4:45
grep --version or grep -V
â Captain Wobbles
Feb 27 at 5:04
1
ok from the error message i am guessing that you are running a solaris system. You can either install gnu grep which does support -A or try the script i edited in
â Captain Wobbles
Feb 27 at 5:20
This is not working. I am getting this help content - abbcd@acsayul000012:/opt/logs$ grep -A 20 "09:55:21,651" CCASWITCH.log grep: illegal option -- A usage: grep [-r] [-R] [-H] [-L] [-E|-F] [-c|-l|-q] [-insvxbhwyu] [-p[parasep]] -e pattern_list... [-f pattern_file...] [file...] usage: grep [-E|-F] [-c|-l|-q] [-insvxbhwyu] [-p[parasep]] [-e pattern_list...] -f pattern_file... [file...] usage: grep [-E|-F] [-c|-l|-q] [-insvxbhwyu] [-p[parasep]] pattern_list [file...] abbcd@acsayul000012:/opt/logs$
â Madhuraj
Feb 27 at 4:30
This is not working. I am getting this help content - abbcd@acsayul000012:/opt/logs$ grep -A 20 "09:55:21,651" CCASWITCH.log grep: illegal option -- A usage: grep [-r] [-R] [-H] [-L] [-E|-F] [-c|-l|-q] [-insvxbhwyu] [-p[parasep]] -e pattern_list... [-f pattern_file...] [file...] usage: grep [-E|-F] [-c|-l|-q] [-insvxbhwyu] [-p[parasep]] [-e pattern_list...] -f pattern_file... [file...] usage: grep [-E|-F] [-c|-l|-q] [-insvxbhwyu] [-p[parasep]] pattern_list [file...] abbcd@acsayul000012:/opt/logs$
â Madhuraj
Feb 27 at 4:30
what version of grep are you using?
â Captain Wobbles
Feb 27 at 4:35
what version of grep are you using?
â Captain Wobbles
Feb 27 at 4:35
How to check the version of grep?
â Madhuraj
Feb 27 at 4:45
How to check the version of grep?
â Madhuraj
Feb 27 at 4:45
grep --version or grep -V
â Captain Wobbles
Feb 27 at 5:04
grep --version or grep -V
â Captain Wobbles
Feb 27 at 5:04
1
1
ok from the error message i am guessing that you are running a solaris system. You can either install gnu grep which does support -A or try the script i edited in
â Captain Wobbles
Feb 27 at 5:20
ok from the error message i am guessing that you are running a solaris system. You can either install gnu grep which does support -A or try the script i edited in
â Captain Wobbles
Feb 27 at 5:20
 |Â
show 1 more comment
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f426845%2fgrep-n-lines-after-match%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
sed
orawk
should be able to do this.â SabreWolfy
Feb 27 at 5:33
you can find the answer in this cross site duplicate ;) stackoverflow.com/questions/17908555/â¦
â Sundeep
Feb 27 at 5:58