I have a file of about 150 lines, where each line is part of a URL. I wanted to extract 4 different parameters from each of the lines and put them into a file. Something like:
/secure/domain/new.aspx?id=620&utm_source=1034&utm_medium=cpc&utm_term=term1&try=1&v=3&utm_account=account_name&utm_campaign=campaign_name&utm_adgroup=adgroup&keyword=keyword1&pkw=pkw1&idimp=id&premt=premt1&gclid=id
As a trial, I did
awk '/pkw/,/&idimp/' file > output.txt
thinking that this would atleast get me value1, but it just returned the input file as is. What am I doing wrong? Also, how to make it return all four values? I'm looking to get keyword, pkw, idimp and premt.
Edit: The expected output is a file containing the 4 values for each of the 150 lines in the input file. So
keyword pkw1 idi premt1
Even if I just get the 4 values in 4 different files, it would suffice.