对于vi查看文件的方式,检索关键词只需在命令行输入
/hello world
(ps:"hello world"是你要搜索的关键词)
对于cat命令查看的文件,则在使用cat时进行如下处理
cat /myfile/aaa.txt | grep hello
(ps:/myfile/aaa.txt为目标文件,hello为关键词)
/hello world
(ps:"hello world"是你要搜索的关键词)
cat /myfile/aaa.txt | grep hello
(ps:/myfile/aaa.txt为目标文件,hello为关键词)