I encountered a problem in my program. I have a list of files and I sort them with this code to find out the 10 most frequent file types in the list.
find $DIR -type f | file -b $SAVEFILES | cut -c1-40 | sort -n | uniq -c | sort -nr | head -10
My output looks like this
168 HTML document, ASCII text
114 C source, ASCII text
102 ASCII text
33 ASCII text, with very long lines
30 HTML document, UTF-8 Unicode text, with
26 HTML document, ASCII text, with very lon
21 C source, UTF-8 Unicode text
20 LaTeX document, UTF-8 Unicode text, with
15 SVG Scalable Vector Graphics image
12 LaTeX document, ASCII text, with very lo
What I want to do is to access the values before the file types and replace them #. I can fdo that with a for loop but first I have somehow access them.
the expected output is something like this:
__HTML document, ASCII text : ################
__C source, ASCII text : ###########
__ASCII text : ##########
__ASCII text, with very long lines : ########
__HTML document, UTF-8 Unicode text, with : #######
__HTML document, ASCII text, with very lon: ####
__C source, UTF-8 Unicode text : ####
__LaTeX document, UTF-8 Unicode text, with: ###
__SVG Scalable Vector Graphics image : #
__LaTeX document, ASCII text, with very lo: #
EDIT: The # are not representing the exect number in my example. First line should have 168 #, second 114 # and so on