Quantcast
Channel: List files where searched term occurs more than a Threshold - Unix & Linux Stack Exchange
Viewing all articles
Browse latest Browse all 3

Answer by cas for List files where searched term occurs more than a Threshold

$
0
0

This will work even if the filename does contain a : character. It uses two capture groups, the first captures everything up to (but not including) the last : character in a line (the filename) and the second capturing all digits after the last : (the count). Input lines not matching that pattern are ignored.

$ rga ... | perl -n -E 'm/^(.*):(\d+)$/; say $1 if $2 > 10'a1.pdfa3.pdf

It won't work on filenames containing newline characters. If you need that, and rga can be made to produce NUL-separated output (e.g. with a -0 or -z or similar option) you could use that in combination with perl's -0 option for reading NUL-separated input.


Viewing all articles
Browse latest Browse all 3

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>