Andy Lester

Results 496 comments of Andy Lester

Find places where two methods with the same name are being called on the same line. `ack -- '->(\w+).*->\1\b'`

Find all the places where I'm making a call like `sort { lc $a cmp lc $b }`. It gets false positive, but it's pretty useful. ack '\bsort\b.+(\w+).+\bcmp\b.+\b(\1)\b'

Show a range of lines in a file: `ack --lines=830-850 filename`. And use `-H` to show what line numbers are.

Find modules that are not using Test::Warn: ack -L 'warnings?_' $(ack -l Test::Warn)

Corrolary to `ack -l cows | ack -x goats` is `ack -L cows | ack -x goats`: Goats in files that do not contain cows.

Find all the subroutines in Perl tests and then give a count of many of each there are: ack '^sub (\w+)' --perltest --output='$1' -h --nogroup | sort | uniq -c...

Summarize the filetypes in your project ``` $ ack --noenv --show-type -f | perl -MData::Dumper -naE'++$n{$F[-1]}; END {print Dumper \%n}' $VAR1 = { 'xml' => 32, 'sql' => 2, 'shell'...

Search all the files that don't have `foo` and show their usage of `bar`. Think of a better example. ack -L foo | ack -x -w bar

Find the most-used modules in your codebase. ack '^use ([\w+:]+)' --output='$1' -h --nogroup | sort | uniq -c | sort -n

Extract part of a line from a logfile ack '>>ip(\S+).+rq"/help' --output='$1' -h