文本搜索命令 grep “aa” hello.py grep 要搜索的内容 要搜索的文件 -i 忽略大小写 -n 显示匹配行号 -v 显示不包含匹配文本的所有行 (取反) grep命令结合正则表达式的使用: $ 以指定字符串结尾 grep ‘a$’ hello.txt ^ 以指定字符串开头 grep ‘^a’ hello.txt . 匹配一个非换行符的字符 grep ‘t.o’ hello.txt 扩展:grep命令还可以文本搜索管道中的内容,比如ls/|grep ‘lib’