一次shell的過濾IP

來源:互聯網
上載者:User

標籤:shell ip

有如下文本:

 {"result":"success","data":[{"ip":"60.18.151.27"},{"ip":"175.22.2.148"},{"ip":"221.204.202.40"},{"ip":"113.107.250.17"},{"ip":"119.97.146.13"},{"ip":"113.56.106.20"},{"ip":"218.60.5.144"},{"ip":"218.58.225.40"},{"ip":"125.76.234.31"},{"ip":"119.97.146.47"},{"ip":"218.60.5.145"},{"ip":"221.204.202.30"},{"ip":"125.76.234.37"},{"ip":"112.25.11.151"},{"ip":"106.4.157.23"},{"ip":"60.8.151.222"},{"ip":"60.8.151.208"},{"ip":"183.56.172.13"},{"ip":"113.107.250.15"},{"ip":"183.232.66.2"},{"ip":"218.58.225.39"},{"ip":"122.70.134.19"},{"ip":"101.226.200.130"},{"ip":"61.183.42.150"},{"ip":"220.165.3.36"},{"ip":"101.226.200.132"},{"ip":"101.226.200.134"},{"ip":"101.226.200.152"},{"ip":"61.183.42.151"},{"ip":"183.56.172.14"},{"ip":"113.17.184.32"},{"ip":"113.107.250.16"},{"ip":"124.193.166.137"},{"ip":"222.186.20.58"},{"ip":"183.56.172.15"},{"ip":"111.1.38.159"},{"ip":"111.1.38.160"},{"ip":"183.232.66.14"},{"ip":"113.17.184.49"},{"ip":"112.25.11.161"},{"ip":"223.87.1.199"},{"ip":"223.87.1.200"},{"ip":"113.56.106.21"},{"ip":"222.186.20.68"},{"ip":"183.250.179.132"},{"ip":"183.250.179.133"},{"ip":"220.165.13.66"},{"ip":"121.194.5.224"},{"ip":"115.25.210.10"},{"ip":"61.153.96.82"},{"ip":"61.153.96.83"},{"ip":"113.105.146.21"},{"ip":"106.4.157.22"},{"ip":"58.220.2.13"},{"ip":"58.220.2.14"},{"ip":"123.125.101.66"},{"ip":"123.125.101.67"},{"ip":"218.6.23.36"},{"ip":"218.6.23.37"},{"ip":"125.39.226.145"},{"ip":"125.39.226.146"},{"ip":"125.39.21.9"},{"ip":"125.39.21.10"},{"ip":"119.147.211.132"},{"ip":"119.147.211.133"},{"ip":"218.76.217.189"},{"ip":"60.18.151.70"},{"ip":"123.149.54.33"},{"ip":"123.149.54.35"},{"ip":"122.70.134.25"},{"ip":"58.222.17.55"},{"ip":"58.222.17.56"},{"ip":"218.29.42.130"},{"ip":"218.29.42.131"},{"ip":"121.18.214.102"},{"ip":"121.18.214.103"},{"ip":"60.169.5.223"},{"ip":"60.169.5.224"},{"ip":"60.8.151.250"},{"ip":"58.220.2.32"},{"ip":"58.220.2.33"},{"ip":"222.88.91.37"},{"ip":"222.88.91.40"},{"ip":"112.253.12.2"},{"ip":"112.253.12.3"},{"ip":"60.210.10.94"},{"ip":"60.210.10.95"},{"ip":"60.210.10.96"},{"ip":"218.77.90.45"},{"ip":"124.193.166.138"},{"ip":"122.226.182.71"},{"ip":"122.226.182.72"},{"ip":"157.122.99.6"},{"ip":"157.122.99.7"},{"ip":"222.174.202.145"},{"ip":"222.174.202.147"},{"ip":"118.180.0.69"},{"ip":"118.180.0.71"},{"ip":"118.180.0.77"},{"ip":"118.180.0.79"},{"ip":"118.116.6.137"},{"ip":"118.116.6.139"},{"ip":"118.116.6.153"},{"ip":"118.116.6.155"},{"ip":"118.116.6.157"},{"ip":"118.116.6.159"},{"ip":"219.153.18.133"},{"ip":"219.153.18.135"},{"ip":"219.153.18.149"},{"ip":"219.153.18.151"},{"ip":"219.153.18.153"},{"ip":"219.153.18.155"},{"ip":"116.55.224.133"},{"ip":"116.55.224.135"},{"ip":"116.55.224.149"},{"ip":"116.55.224.151"},{"ip":"112.67.254.133"},{"ip":"112.67.254.135"},{"ip":"180.138.20.137"},{"ip":"180.138.20.139"},{"ip":"180.138.20.153"},{"ip":"183.61.10.141"},{"ip":"183.61.10.143"},{"ip":"183.61.10.145"},{"ip":"183.61.10.147"},{"ip":"183.62.114.137"},{"ip":"183.62.114.139"},{"ip":"183.61.182.137"},{"ip":"183.61.182.139"},{"ip":"183.57.148.141"},{"ip":"183.57.148.143"},{"ip":"59.53.89.133"},{"ip":"59.53.89.135"},{"ip":"59.53.89.145"},{"ip":"59.53.89.147"},{"ip":"124.112.125.137"},{"ip":"124.112.125.139"},{"ip":"122.228.227.137"},{"ip":"122.228.227.139"},{"ip":"110.80.128.17"},{"ip":"110.80.128.19"},{"ip":"60.221.255.174"},{"ip":"60.221.255.175"},{"ip":"124.167.232.200"},{"ip":"124.167.232.201"},{"ip":"61.133.59.7"},{"ip":"61.133.59.8"},{"ip":"175.22.2.8"},{"ip":"175.22.2.9"},{"ip":"222.162.143.131"},{"ip":"222.162.143.132"},{"ip":"61.137.188.200"},{"ip":"61.137.188.201"},{"ip":"60.10.180.198"},{"ip":"60.10.180.199"},{"ip":"113.57.186.136"},{"ip":"113.57.186.137"},{"ip":"60.28.226.134"},{"ip":"60.28.226.135"},{"ip":"175.22.2.164"},{"ip":"183.136.166.147"},{"ip":"183.232.66.59"},{"ip":"61.172.237.151"},{"ip":"61.172.237.153"},{"ip":"124.238.243.11"},{"ip":"124.238.243.13"},{"ip":"106.41.94.11"},{"ip":"106.41.94.13"},{"ip":"183.61.10.157"},{"ip":"183.61.10.159"},{"ip":"183.57.148.149"},{"ip":"183.57.148.151"}]}

要求過濾出所有的IP

egrep -o ‘[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}‘ text.txt  營運給出的方法grep -oP ‘((\d)+.){3}\d+‘ test.txt                DBA給出的方法sed -e s/\"}/\\n/g -e s/[^0-9\.\\n]//g txt        程式猿給出的方法

第二種方法是最佳的!

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.