Quantcast
Channel: UNIX and Linux Forums
Viewing all articles
Browse latest Browse all 16232

Format a log file using sed

$
0
0
I am looking to extract something like this from the below sample log file.

10.28.76.15 SSLC=Z42 71.19.175.130
10.28.76.15 SSLC=Z42 71.19.175.130
10.28.76.15 SSLC=Z42 71.19.175.130

for that I tried something like below and I have no clue how to extract the IP address marked red in the log file to the o/p.

Code:

egrep "10.28.76.15|10.28.86.15" log.file | sed 's/\([^ ]*\).*\(SSLC=...\).*/\1 \2/'
Sample log file below.
Code:

10.28.76.15 SSLC=Z42" www.crazynet.com "GET /site/transportationScripts.js?skin=enhk.muttusoochi.com.hk HTTP/1.1" 200 10351 8245 "71.19.175.130, 10.28.76.15"

10.28.76.15 SSLC=Z42" www.crazynet.com "GET /site/carrier_AS.gif?skin=default HTTP/1.1" 200 1962 2717 "71.19.175.130, 10.28.76.15"
10.28.76.15 SSLC=Z42" www.crazynet.com "GET /site/footer-logo-truste-100x28.png?skin=enhk.muttusoochi.com.hk HTTP/1.1" 200 1096 2027 "71.19.175.130, 10.28.76.15"

It would be a great help if some one here can help me to solve this.

Viewing all articles
Browse latest Browse all 16232

Trending Articles