如何在文本中找到否定词?

时间:2011-01-29 21:55:34

标签: regex

我怎么发现所有不包含这个词的行:“_ archive”???

XXXXXXXXXXXXXXXXXXXXXXXXX _archive 1
XXXXXXXXXXXXXXXXXXXXXXXXX _archive 2
XXXXXXXXXXXXXXXXXXXXXXXXX teste 1
XXXXXXXXXXXXXXXXXXXXXXXXX _archive 3
XXXXXXXXXXXXXXXXXXXXXXXXX teste 2
XXXXXXXXXXXXXXXXXXXXXXXXX _archive 4
XXXXXXXXXXXXXXXXXXXXXXXXX teste 3
XXXXXXXXXXXXXXXXXXXXXXXXX _archive 5
XXXXXXXXXXXXXXXXXXXXXXXXX _archive 6
XXXXXXXXXXXXXXXXXXXXXXXXX _archive 7
XXXXXXXXXXXXXXXXXXXXXXXXX _archive 8
XXXXXXXXXXXXXXXXXXXXXXXXX teste 4
XXXXXXXXXXXXXXXXXXXXXXXXX _archive 9
XXXXXXXXXXXXXXXXXXXXXXXXX _archive 10
XXXXXXXXXXXXXXXXXXXXXXXXX _archive 11
XXXXXXXXXXXXXXXXXXXXXXXX teste 5

由于

2 个答案:

答案 0 :(得分:3)

使用grep -v

grep -v _archive inputfile.txt

此命令打印出inputfile.txt包含_archive的每一行。

答案 1 :(得分:0)

假设您的文件位于“file.txt”

以下unix命令会这样做

grep -v _archive file.txt