linux 用grep匹配横线

file的内容如下:
ADSFADSFSDFASDFJKJK
----------------------------------------
ADSFADSFSDFASDFJKJK
----------------------------------------
ADSFADSFSDFASDFJKJK


linux 用grep匹配第2行和第4行横短线:
grep "^-*$" file
linux 用grep匹配不含横短线的行:
grep -v "^-*$" file


匹配多个字符串
grep 'string1\|string2' filename

grep -E "string1|string2" filename
 
posted @ 2013-09-08 11:14  emanlee  阅读(2117)  评论(0编辑  收藏  举报