如何grep“ "在文件中 [英] How to grep " " in file
本文介绍了如何grep“
"在文件中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
示例文件:abc.ksh
Sample file : abc.ksh
echo "This is a sample file." >> mno.txt
echo "
This line has new line char." >> mno.txt
我想要
echo "
This line has new line char." >> mno.txt
作为输出.
推荐答案
使用 -F
匹配固定字符串:
Use -F
to match fixed strings:
$ grep -F "
" file
echo "
This line has new line char." >> mno.txt
来自man grep
:
-F, --fixed-strings
将 PATTERN 解释为固定字符串列表,以换行符分隔,其中任何一个是要匹配的.(-F 由 POSIX 指定.)
Interpret PATTERN as a list of fixed strings, separated by newlines, any of which is to be matched. (-F is specified by POSIX.)
这篇关于如何grep“ "在文件中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文