如何用shell取出如下字符中的ip地址?
Failedpasswordforadmfrom58.248.38.108port21918ssh2Failedpasswordforddsfrom58.248.32.1...
Failed password for adm from 58.248.38.108 port 21918 ssh2
Failed password for dds from 58.248.32.108 port 21918 ssh2
Failed password for invalid user student from 58.248.38.108 port 21918 ssh2
Failed password for invalid user stnt from 58.248.38.18 port 21918 ssh2 展开
Failed password for dds from 58.248.32.108 port 21918 ssh2
Failed password for invalid user student from 58.248.38.108 port 21918 ssh2
Failed password for invalid user stnt from 58.248.38.18 port 21918 ssh2 展开
展开全部
cat aa.txt | awk '{for(i =1; i <=NF; i++){ if($i~/[0-9]\.[0-9]/) print $i}}'
把上面内容保存到aa.txt文件中,然后执行上面语句。
把上面内容保存到aa.txt文件中,然后执行上面语句。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
Storm代理
2023-07-25 广告
2023-07-25 广告
StormProxies是一家提供动态代理服务器服务的企业,旨在帮助用户更好地管理网络访问和安全。以下是一些关于StormProxies的IP动态代理服务的特点:1. 高匿名性:StormProxies的动态代理服务器具有高匿名性,可以有效...
点击进入详情页
本回答由Storm代理提供
展开全部
[seesea@UC ~]$ cat b.txt
Failed password for adm from 58.248.38.108 port 21918 ssh2
Failed password for dds from 58.248.32.108 port 21918 ssh2
Failed password for invalid user student from 58.248.38.108 port 21918 ssh2
Failed password for invalid user stnt from 58.248.38.18 port 21918 ssh2
[seesea@UC ~]$ grep -oP '\d+\.\d\+\.\d+\.\d+' b.txt
[seesea@UC ~]$ grep -oP '\d+\.\d+\.\d+\.\d+' b.txt
58.248.38.108
58.248.32.108
58.248.38.108
58.248.38.18
Failed password for adm from 58.248.38.108 port 21918 ssh2
Failed password for dds from 58.248.32.108 port 21918 ssh2
Failed password for invalid user student from 58.248.38.108 port 21918 ssh2
Failed password for invalid user stnt from 58.248.38.18 port 21918 ssh2
[seesea@UC ~]$ grep -oP '\d+\.\d\+\.\d+\.\d+' b.txt
[seesea@UC ~]$ grep -oP '\d+\.\d+\.\d+\.\d+' b.txt
58.248.38.108
58.248.32.108
58.248.38.108
58.248.38.18
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询