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


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