首页
首页 » 文档编辑 » fgrep(fixed regexp)

fgrep(fixed regexp)

fgrep(fixed regexp)
功能说明:查找文件里符合条件的字符串。
语  法:fgrep [范本样式][文件或目录...]
补充说明:本指令相当于执行grep指令加上参数"-F",详见grep指令说明。

fgrep

fgrep [options] string [files]

Search one or more files for lines that match the specified text string. Exit status is 0 if any lines match, 1 if not, and 2 for errors. fgrep is faster than normal grep searches, but less flexible: it can only find fixed text, not regular expressions.

See grep for the list of available options. Also see egrep.

Examples

Print lines in file that don't contain any spaces:

fgrep -v ' ' file

Print lines in file that contain the words in the file spell_list:

fgrep -f spell_list file