I want to capture a string 1 row affected..
. But problem is there are no of such string present in the same file.
My concern to capture 1 row affecte
If you have GNU grep, you can make use of its ability to display trailing context of matches:
cmd... | grep -A 5 "Job completed successfully" | grep "1 row affected"
The first grep
will look for the string Job completed successfully
, while also providing the five subsequent lines. It is in those lines that the other grep
looks for 1 row affected
, and prints the match.