Dear readers,
I have a script that counts the number of files in particular directories in my home location and displays the output. Now I have 13 directories in my home location. I am getting the output as :
Avishek_dir 13
Kunal_dir 17
Shantanu_dir 18
Arup_dir 12
Pranabesh_dir 19
.
.
.
etc
like this
I want the output like
Avishek_dir--------13
Kunal_dir ---------17
Shantanu_dir------18
Arup_dir-----------12
Pranabesh_dir-----19
Can you tell me how to do it :).
Thanks in advance .
Regards
Avishek
whats the diff...???both look same
I want the directory name and the output to be distributed linear fashion, like in two coloumns .
Pipe the output to:
awk '{printf("%-25s%s\n",$1,$2)}'
use printf to print o/p
if you know the length of the longest dir name then you can easily format it if not calculate it and format
for ex:
printf("%-20s%-3s",diname,file_count)
the length of the longest directory is 17 ... where to use that length ...
then as Franklin suggested pass the o/p of your script to
script_name|awk '{printf("%-25s%s\n",$1,$2)}'
vidyadhar85:
then as Franklin suggested pass the o/p of your script to
script_name|awk '{printf("%-25s%s\n",$1,$2)}'
awsome !!!! its working ..
thanks a lot to you and Franklin