Re:Finding CSV files that start with a BOM using ripgrep
by xorcist on Saturday May 29, 2021 @07:40AM
(#27324605)
The cmp in coreutils understands:
-n, --bytes=LIMIT compare at most LIMIT bytes
so head is not really necessary: find . -name '*.csv' -type f -exec cmp -sn 3 {} bom.dat \; -print
Using -exec as a filter is a nice feature more people should use. That -type was put there just to avoid directories.
Could be made into a oneliner by replacing the 'bom.dat' argument to cmp with '<(printf ...)'.