2

I have a long and generic squid log file. My boss is asking me to extract IP's alongside with accessed URLs. So far I can process IP's, but I need those IP's listed with the URLs accessed.

Something like:

172.10.1.20 http://url1.com
3

Normally squid logs has IP's on 3rd field and access URL's on 7th field of log file, if it is different in your system then adjust number accordingly.

using awk,

awk '{print $3 " " $7}' logfile

using cut,

cut -d' ' -f3,7 logfile

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.