[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#26726: Support grepping multi-lines fixed-strings
From: |
ziyunfei |
Subject: |
bug#26726: Support grepping multi-lines fixed-strings |
Date: |
Mon, 1 May 2017 14:38:46 +0800 |
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
- bug#26726: Support grepping multi-lines fixed-strings,
ziyunfei <=