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