Loop to curl multiple ips to ipinfo.io

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 :stuck_out_tongue: )

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.

Do not post classroom or homework problems in the main forums. Homework and coursework questions can only be posted in this forum under special homework rules.

Please review the rules, which you agreed to when you registered, if you have not already done so.

More-than-likely, posting homework in the main forums has resulting in a forum infraction. If you did not post homework, please explain the company you work for and the nature of the problem you are working on.

If you did post homework in the main forums, please review the guidelines for posting homework and repost.

Thank You.

The UNIX and Linux Forums.