我有一个文件夹内的子文件夹,都有很多types的文件。 我想在.css
文件中search一个单词。 我正在使用Windows 7,我有grep
。
我如何使用grep
来:
其实你不需要find
。 只要使用:
grep -R --include=*.css -H pattern .
这将递归并查找子目录中的所有* .css,而-H将显示文件名。
找到文件夹/ -name“* .css”| xargs grep“your-pattern”
你将需要安装cygwin来做到这一点。
如果我们必须查找的文件有模式,那么我们可以使用它。 考虑我正在寻找名为chap1.lst chap2.lst
等文件中的模式“cardlayout”。 那么命令
grep -e 'cardlayout' ` find . -name "chap??.lst"`
希望这会有所帮助