Use a regex like this one:
_id=([a-f0-9]+)&
The parenthesis define a group which you can retrieve from the results.
Drew Noakes
2009-09-19 20:29:26
Use a regex like this one:
_id=([a-f0-9]+)&
The parenthesis define a group which you can retrieve from the results.
id=([^&]*)&
The data between id= and & will be matched by the first (and only) group and then be accessible via .group(1)
or similar depending on the language/regex library.
Edit: Changed +
to *
as per Johannes Rössel's suggestion.
I'd use
perl -ne 'm/[&?]_id=([^&]+)(&|$)/ && print $1;' [file]
where [file]
is the name of the file containing the data.