Bash 用于显示/管道显示两列的脚本

Bash script for displaying / pipeing two columns

我有这个 bash 脚本:

#!/bin/bash                                                                         
while IFS='"' read -r a ip c
do
    echo "ip: $ip"
    whois "$ip" | grep descr
done < <(sort -nr  | head -10)

从该文件中取出第二列:

2132  "291.2.1.42"
5645  "231.26.12.77"
..

然后像这样从 whois 请求中获取描述字段:

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 以便能够解决这种复杂程度?

更改为:

#!/bin/bash                                                                         
while IFS='"' read -r a ip c
do
    printf "Views: $a\tip: $ip\n"
    whois "$ip" | grep descr
done < <(sort -nr  | head -10)