原题:
Write a command line that counts how many times the word 'for' appears in python files (files that end with .py) within your current directory. The resulting number should be placed in a file called 'result
下面是我写的命令,但是不知道如何修改能实现输出到某个文件中的功能
grep -o for *.py | wc -l
重定向到文件就好了:
grep -R -o for *.py | wc -l >abc.txt