agrep gives the error agrep: pattern too long (has > 32 chars)
when there is a full stop(.) in the pattern string but not otherwise.
I want to compare(approximately) two strings, so I'm using agrep for that but its giving an error agrep: pattern too long (has > 32 chars)
. But I found out that it doesn't give the error if there is no full stop in the pattern string(why?)
`echo "The quick brown fox jumped over the lazy dog." | agrep -c -4 "The quick brown fox jumped over the lazy dog."`
expected output is 1 instead it gives an error:
agrep: pattern too long (has > 32 chars)
it works if I remove the full stop:
$ echo "The quick brown fox jumped over the lazy dog." | agrep -c -4 "The quick brown fox jumped over the lazy dog"
1
Approximate string matching / fuzzy string searching with two strings.
With agrep
and bash
:
if agrep -1 "abc" <<< "xbc" >/dev/null; then echo "match"; else echo "no match"; fi
or with tre-agrep
and bash
:
if tre-agrep -q -1 "abc" <<< "xbc"; then echo "match"; else echo "no match"; fi
Output in both cases:
match
来源:https://stackoverflow.com/questions/57533885/how-to-fix-error-agrep-pattern-too-long-has-32-chars-it-doesnt-show-error