Strainer is a command-line tool that will recursively search the text files in a directory, track all duplicate lines across files, and output the matched lines and where they reside in each file.
Strainer is available on cargo.io:
cargo install strainer
It has one compile-time feature flag: syntax-highlighting
. With this enabled
the syntect
library will be used to automatically syntax-highlight code lines
in the output. This roughly doubles the binary size (it's still small) and slows
down the output a bit (not the search itself), and the coloration is also broken
on the default macOS terminal app (iTerm2 works fine).
cargo install strainer --features "syntax-highlighting"
```
USAGE:
strainer [FLAGS] [OPTIONS]
FLAGS: -h, --help Prints help information -r, --removeduplicates Remove duplicate lines (keep the first occurrence). Requires --samefile. DANGER: Overwrites source files, use with caution! -s, --samefile Only check for duplicate lines within the same file. -t, --trimwhitespace Trim whitespace from the start and end of each line before comparing. -V, --version Prints version information
OPTIONS:
-d, --linedelimiter
ARGS: