I am running geoiplookup command on linux, which gives the following:
[root@localhost temp]$ geoiplookup 8.8.8.8
GeoIP Country Edition: US, United States
GeoIP City Edition, Rev 1: US, N/A, N/A, N/A, 38.000000, -97.000000, 0, 0
GeoIP City Edition, Rev 0: US, N/A, N/A, N/A, 38.000000, -97.000000
GeoIP ASNum Edition: AS15169 Google Inc.
I want the output to be on one line and have tried this:
[root@localhost temp]$ geoiplookup 8.8.8.8 | sed '2,3d' | sed 's/^.*: /,/g' | sed '$!{:a;N;s/\n/\t/;ta}' | awk -F ',' '{print $4","$2}'
AS15169 Google Inc.,US
Sorry to make you misunderstand. I want to use easier way to keep the country code and ASNum as the output line.
Like thie "AS15169 Google Inc.,US"