谢谢您的关心。我是一个新手,正在尝试使用geoiplookup -f GeoLiteCity.dat命令批量查找ip。
我有700多个ips要查找,它们保存为c.txt (在同一文件夹中),如何创建一个bash shell脚本?我已经做了一个,我得到的只是:
sudo: unable to execute ./ok.sh: No such file or directory这是我的脚本

使用另一种语言是可以的。
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)我是韩国人,为我糟糕的英语感到抱歉,但我找不到任何我的语言怎么做。我真的很感激,否则我得一个接一个地查到周五...(因为我公司的网速非常慢)
请帮帮我。我会在每个星期天早上为你祈祷。谢谢。
发布于 2016-03-20 22:31:18
我找到了一个非常简单的答案,用duckduckgo搜索“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将其另存为iplookup.sh并运行,不带'sudo':
bash iplookup.sh经过测试并正常工作。请务必将您的文件'c.txt‘重命名为'ipaddresses.txt’!此外,'ipaddresses.txt‘文件必须在同一目录中
https://stackoverflow.com/questions/36113011
复制相似问题