GNU bug report logs - #26726
Support grepping multi-lines fixed-strings

Previous Next

Package: grep;

Reported by: "ziyunfei" <446240525 <at> qq.com>

Date: Mon, 1 May 2017 06:54:01 UTC

Severity: wishlist

Full log


View this message in rfc822 format

From: "ziyunfei" <446240525 <at> qq.com>
To: 26726 <at> debbugs.gnu.org
Subject: bug#26726: Support grepping multi-lines fixed-strings
Date: Mon, 1 May 2017 14:38:46 +0800
[Message part 1 (text/plain, inline)]
I have the same need as http://stackoverflow.com/questions/14631794/check-if-file-contains-some-text-not-regex-in-unix#comment20438757_14631832.


$ cat file
foo
bar

$ echo "$fixed_string"
bar
foo

$ grep -Fzq "$fixed_string" file && echo "Matched" || echo "Not matched"
Matched # false positive, -z doesn't apply to -F


$ [[ "$(cat file)" = *"$fixed_string"* ]] && echo "Matched" || echo "not matched"
not matched # my workaround
[Message part 2 (text/html, inline)]

This bug report was last modified 7 years and 363 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.