1

Thank you for your concern. I'm a noob trying to bulk-ip-lookup with [geoiplookup -f GeoLiteCity.dat] command.

I have more than 700 ips to lookup which saved on as c.txt (on the same folder) How can I make a bash shell script? I've already made one and all I got was:

sudo: unable to execute ./ok.sh: No such file or directory

Here is my script

enter image description here

It would be all - ok to use another language.

To make it more clear;
[geoiplookup -f GeoLiteCity.dat IP1]
[geoiplookup -f GeoLiteCity.dat IP2]
             ...
[geoiplookup -f GeoLiteCity.dat IP700]
and save them as one text file. (Which would be 700 row)

I'm Korean and sorry for my poor English, but I couldn't find any in my language how to do this. I'll really appreciate it, or I have to look up 1 by 1 till Friday... (as internet speed is extremely slow in my company)

Please help me. I will pray for you at every sunday morning. Thank you.

7
  • Did you make ok.sh executable? For example: chmod a+x ok.sh? Commented Mar 20, 2016 at 11:20
  • it keep says bash: ./ok.sh /usr/bin/bash: bad interpreter: No such file or directory Commented Mar 20, 2016 at 11:45
  • Thank you kaylum. I've tried the chmod and afterward it keep argues no such file...T^T Commented Mar 20, 2016 at 11:46
  • 1
    Are you sure bash is installed in /usr/bin? What does which bash tell you? Commented Mar 20, 2016 at 11:54
  • sorry kaylum. due to electronic issue, I got anther computer to use. (which has lower cpu than before) and just checked it now; i will install linux again soon Commented Mar 20, 2016 at 12:52

1 Answer 1

1

found a very simple answer with a duckduckgo search for 'iterate through each line of file bash' stackoverflow.com/questions/1521462/looping-through-the-content-of-a-file-in-bash

  #!/usr/bin/bash

  printf "\n\n"

  while read ip; do
          echo "LOOKING UP IP $ip"
          geoiplookup $ip
          printf "\n\n"
  done < ipaddresses.txt

save it as iplookup.sh and run, without 'sudo':

    bash iplookup.sh

tested and working. be sure to rename your file 'c.txt' to 'ipaddresses.txt' ! also the 'ipaddresses.txt' file must be in the same directory

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.