I encountered a problem while writing my bash script
cutfiles=`find $DIR -type f |
file -b $SAVEFILES |
cut -c1-40 |
sort -n |
uniq -c |
sort -nr |
head -10 |
while read -r n text; do
printf " %s...%$((40-${#text}))s: " "$text"
for ((i=0;i<$n;i++)); do
printf "%s" "#"
done
echo
done`
Output looks like this:
ASCII text... : #######
empty... : ####
Bourne-Again shell script, ASCII text...: ##
PDF document, version 1.4... : #
What i am trying to do is put the dots only when the file type is longer than 40 not always. Example:
ASCII text : #######
empty : ####
Bourne-Again shell script, ASCII text...: ##
PDF document, version 1.4 : #
Is there a way to do it?