Jim Meyering wrote: > Here's perl-based gorp that's uncovered a few more. > The tricky part was to get the line numbers while in perl's > slurp-entire-file mode (-0777). > > git ls-files|xargs perl -0777 -n \ > -e 'while (/\b(a|then?|if|but|or|and|to)\s+\1\b/gms)' \ > -e '{$n=($` =~ tr/\n/\n/ + 1); ($v=$&)=~s/\n/\\n/; print "$ARGV:$n:$v\n"}'
For slightly better coverage (and more false positives) add "i" to the regexp options: git ls-files|xargs perl -0777 -n \ -e 'while (/\b(a|then?|if|but|or|and|to)\s+\1\b/gims)' \ -e '{$n=($` =~ tr/\n/\n/ + 1); ($v=$&)=~s/\n/\\n/; print "$ARGV:$n:$v\n"}'