I want to process the body of text and extract an integer from a specific position in the text, but I'm not sure how to describe that 'particular position'. Regular expressions really confuse me. I spent (wasted) a couple hours reading tutorials and I feel no closer to an answer :(
There's a bunch of text which may or may not include integers (that I don't want) and then there's a line that always contains
id_ad=1929170&action
and then followed by a bunch of garbage I don't care about, again it may or may not include one or more integers.
So intuitively I know I just want to ignore everything up to (and including) id_ad=
and ignore everything after (and including) &action
and I'll be left with the integer I want. And I know I can use regular expressions to achieve this. But I can't seem to figure it out.
I'd like to do this as a one liner from terminal if possible.