试题
考点

脚本语言-shell-grep、awk、sed

面5笔5

找出当前目录下包含127.0.0.1关键字的文件?

前往“校招VIP”小程序,刷题更快
最新校招难题刷题,快来进刷题群吧
解答

方法1

grep "127.0.0.1" ` find -type f `
sed -n '/127.0.0.1/p' ` find -type f`
awk '/127.0.0.1/' ` find -type f`

方法2

find -type f | xargs grep "127.0.0.1"
find -type f | xargs sed -n '/127.0.0.1/p'
find -type f | xargs awk '/127.0.0.1/'

方法3

find -type f -exec grep "127.0.0.1" {} \
find -type f -exec sed -n '/127.0.0.1/p' {} \
find -type f -exec awk '/127.0.0.1/' {} \

文章链接

评论
暂无评论

加载更多