Linux How to print all the files with the same prefix after searching for them?
- by Alyx
I need to search through a directory which contains many sub directories, each which contain files. The files read as follows question1234_01, where 1234 are random digits and the suffix _01 is the number of messages that contain the prefix, meaning they are apart of the same continuing thread.
find . -name 'quest*' | cut -d_ -f1 | awk '{print $1}' | uniq -c | sort -n
example output:
1 quest1234
10 quest1523
This searches for all the files then sorts them in order.
What I want to do is print all the files which end up having the most occurrences, in my example the one with 10 matches.
So it should only output quest1523_01 - 11