Skip to content

Instantly share code, notes, and snippets.

@kartikeytewari
Created January 14, 2021 17:28
Show Gist options
  • Select an option

  • Save kartikeytewari/4a2ad218b9c15c8755787f4f62adc472 to your computer and use it in GitHub Desktop.

Select an option

Save kartikeytewari/4a2ad218b9c15c8755787f4f62adc472 to your computer and use it in GitHub Desktop.

Revisions

  1. kartikeytewari created this gist Jan 14, 2021.
    9 changes: 9 additions & 0 deletions get_uniq_city_name.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,9 @@
    cat server_log_14-01-2021.log | egrep -o '([0-9]{1,3}\.){3}[0-9]{1,3}' | sort | uniq > temp_file
    cat temp_file | while read line
    do
    curl "https://tools.keycdn.com/geo.json?host=$line" 2>/dev/null | jq .data.geo.city >>country_name_of_requests
    done

    cat country_name_of_requests | sort
    rm temp_file
    rm country_name_of_requests