Hi there,
How can I specify in my regex (I am using grep in Cygwin, perl regex with -P) to look for a particular text in a line and to carry on extracting all the lines until it finds another text that i am interested in.
for example, the following is the text file
line 1 there is error
there are some info
this info is not important
error count is 42
line 2 there is no error
there are some info
line 3 there is error
there are some info
this info is not important
error count is 35
so basically, what I want from this text file is
line 1 = 42
line 3 = 35
i need to know the error count if there are any for the line no.
for starters, I have this regex grep -i -P 'is error/r$' mytext.txt (to get the line with eror)
but do i specify to grep that keep selecting the lines until you find a line that ends with digits [0-9]*$?
thanks
Start Free Trial