I have to find all file types using file -b $(find . -type f)
, sort them into unique categories, and print out top 4 most categories where the number is replaced with equal number of "#".
The output should look something like this:
8 empty : ########
6 ASCII text : ######
3 Vim swap file, version 7.4 : ###
1 UTF-8 Unicode text : #
I can't figure out how to print out the number of files in each category as "#" marks.
I want get the number on each line as a value and put same amount of "#" marks at the end.
find . -type f -exec file -b {} \; | sort | uniq -c
How do i use the number fromuniq -c
in that awk? I am just trying to understand it. – Buri Mar 25 '17 at 15:26| awk '{printf $0" : "; for(c=0;c<$1;c++){printf "#"}; printf "\n"}'
– don_crissti Mar 25 '17 at 15:37