grep 的另类用法

文摘 Ubuntu 2020-05-20 阅读:4479

(1) grep指定h文件类型查找hello字符串:

find -type f -name '*.h' | xargs grep "hello"

(2) grep排除java和c文件类型查找hello字符串

grep "hello" -nR --exclude=*.{java,c}

(3) 排除lib目录查找文件init.c

find -name lib -prune -o -name init.c


原文链接:https://blog.csdn.net/wenwang88/java/article/details/79254337

0条评论

© 2024 芯缘异码. Powered by Typecho