My source is on each line
98.194.245.255 - - [29/Nov/2010:16:59:59 -0700] "GET /disp0201.php?poc=4060&roc=1&ps=R&ooc=13&mjv=6&mov=5&rel=5&bod=155&oxi=2&omj=5&ozn=1&dav=20&cd=&daz=&drc=&mo=&sid=&lang=EN&loc=JPN HTTP/1.1" 302 - "-" "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0; .NET CLR 1.0.3705; .NET CLR 1.1.4322; Media Center PC 4.0; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)"
I need to print string from disp to blank space into a file
expecting output as
disp0201.php?poc=4060&roc=1&ps=R&ooc=13&mjv=6&mov=5&rel=5&bod=155&oxi=2&omj=5&ozn=1&dav=20&cd=&daz=&drc=&mo=&sid=&lang=EN&loc=JPN
Please help me on this...
EM
awk '{sub(/\//,"",$7);print $7}' infile
Using the above command I am getting Output as
"GET
I need text from disp to blank space
disp0201.php?poc=4060&roc=1&ps=R&ooc=13&mjv=6&mov=5&rel=5&bod=155&oxi=2&omj=5&ozn=1&dav=20&cd=&daz=& drc=&mo=&sid=&lang=EN&loc=JPN
If you could explain the syntax - it would help everyone who reads this thread.
Many Thanks,
EM
---------- Post updated at 09:40 AM ---------- Previous update was at 09:13 AM ----------
Thanks for your insight... It worked when using print column $8..Can you please explain the above awk command...will be really helpful for everyone.
rdcwayx
4
That's the very basic awk command, recommend you read the help first.
The GNU Awk User's Guide
cabrao
6
awk '{print substr($7,2)}' file
If expected output includes drc=&mo=&sid=&lang=EN&loc=JPN
, try this:
awk '{print substr($7,2),$8}' file