[TRE-general] $ doesn't match end-of-line
William J Poser
wjposer at ldc.upenn.edu
Fri May 12 09:47:44 EEST 2006
Sebastian Nagel wrote:
I found the following unexpected (somewhat unusual behaviour) of agrep.
Maybe it's a feature?
[volga:~] echo -e "asdf" | agrep '^asdf$'
[volga:~] echo -e "asdf" | agrep '^asdf\n$'
asdf
[volga:~] agrep -V
agrep (TRE agrep) 0.7.3
I ran into the same thing. It seems that agrep includes the record
delimiter in the record. This is borne out by using the -d flag
to set the delimiter, e.g.:
[175]: echo 'a919:9' | agrep -d 9 -M '\D'
a9:9
[176]: echo 'a919:9' | agrep -d 9 -M '\d'
a919:9[177]:
In the second case we get three matches rather than the
expected match only to "1" because the delimiter,
"9", is included in the record, so both "a9" and ":9" match
since they contain a digit.
This is non-standard (in the sense of
different from other greps) but could be useful. I would change the
default but perhaps keep this as an option.
Bill
More information about the TRE-general
mailing list