I am rather new to shell scripting and currently taking a linux course.
Im having some troubles writing a loop to curl multiple ips in mutiple access logs to the site ipinfo.io and push the output to a text file for easy viewing and removing duplicates.
So far i have these simple lines
cat /home/access_log | awk '{ print $1 }' | sort | uniq -c | sort -n
- Brings up a sorted list of ips in this access log
xzcat /home/access_log-20160917.xz | awk '{ print $1 }' | sort | uniq -c | sort -n
xzcat /home/access_log-20161005.xz | awk '{ print $1 }' | sort | uniq -c | sort -n
and this is my sample curl command of one single ip address
curl --header "X-Forwarded-For: 137.226.113.7" ipinfoio
(cant post urls yet )
Now this is where i get stuck......i dont know where to begin when it comes to combining all the logs together then using cat to put them all into one single file. I then want to create a loop that takes all those ips and curls them to ipinfo and then redirecting the output to a text file. Please and thank you for the help. Sorry for the ignorance.