feature suggestion - exclude count of files with 0 matches

View: New views
1 Messages — Rating Filter:   Alert me  

feature suggestion - exclude count of files with 0 matches

by ciaranpower :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

I often find myself looking for an ordered count of the number of files
matching a pattern in a directory e.g.

grep -cr pattern . | sed '/:0$/d' | sort -k2n -t:

The 'sed' removes files with 0 matches (which I'm not interested in) e.g.
foo:0

As I'm sure I'm not the only one doing this:
how about an option (maybe -N?) to exclude files with 0 matches from output?

Thanks,
Ciaran


LightInTheBox - Buy quality products at wholesale price!