GREP IP范围Bash脚本
我刚刚开始bash脚本,我很难从文件中获得特定的IP范围。
我已经尝试了以下操作:
grep "213.184.111.[128][254]" example.txt
使用seq
或sort
有一种更轻松的方法吗?
I just got into Bash scripting and I'm having a hard time grepping a specific IP range from a file.
I've tried the following:
grep "213.184.111.[128][254]" example.txt
Is there an easier way using seq
or sort
?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
当
awk
也是可能的。使用。
作为字段分离器,并比较第四字段。输出:
请参阅: 8强大的内置变量 - fs ,ofs,rs,ors,nr,nr,nf,nf,filename,fnr
When
awk
is also possible. Use.
as field separator and compare fourth field.Output:
See: 8 Powerful Awk Built-in Variables – FS, OFS, RS, ORS, NR, NF, FILENAME, FNR
我的同事刚刚帮我解决了以下问题:
有更简单的选择吗?
My colleague just helped me out with the following:
Is there an easier option?