我有一个bash脚本:
#!/bin/bash
while IFS='"' read -r a ip c
do
echo "ip: $ip"
whois "$ip" | grep descr
done < <(sort -nr $1 | head -10)它将第二列从该文件中删除:
2132 "291.2.1.42"
5645 "231.26.12.77"
..并将描述字段从这样的用户请求中删除:
ip: 62.178.124.23
descr: UPC Telekabel
descr: DHCP Range我现在还需要提取源文件中的第一列,并将其显示在IP入口旁边,如下所示:
Views: 72123 ip: 62.178.124.23
descr: UPC Telekabel
descr: DHCP Range如何实现?或者我应该切换到python,以便能够处理这个复杂程度的问题?
发布于 2015-01-20 12:52:45
改为:
#!/bin/bash
while IFS='"' read -r a ip c
do
printf "Views: $a\tip: $ip\n"
whois "$ip" | grep descr
done < <(sort -nr $1 | head -10)https://stackoverflow.com/questions/28045247
复制相似问题