~kris/dots

srice

ref: 178c9a25a484ead715392d50e21d03df486b8b41 srice/.local/bin/dups -rwxr-xr-x 484 bytes
178c9a25 — Kris Yotam conky: sync proper config from moirai (was the greenred variant) 2 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/usr/bin/env perl
# dups -- find duplicate adjacent words
use strict;
my $red = "\033[0;31m";
my $reset = "\033[0m";
my $count = 0;
my $lastword = "";
while (<>) {
    chomp;
    my @words = split /\s+/;
    foreach my $word (@words) {
        my $lc = lc($word);
        $lc =~ s/[^a-z]//g;
        if ($lc eq $lastword && $lc ne "") {
            print "$ARGV:$.: ${red}$word${reset}\n";
            $count++;
        }
        $lastword = $lc;
    }
}
exit ($count > 0 ? 1 : 0);