i have a commad that display the total each directory size in KB.Below the commad and o/p:
ls -ltr | grep ^d | awk '{print $9}' | xargs du -sk
output:
what i want is the proper tab space b/w value and dir.? how to get that.
thanks in advance
i have a commad that display the total each directory size in KB.Below the commad and o/p:
ls -ltr | grep ^d | awk '{print $9}' | xargs du -sk
output:
what i want is the proper tab space b/w value and dir.? how to get that.
thanks in advance
find ./* -type d -prune -print | xargs du -sk | sed 's/ /\t/'
Needs fewer program invocations too.
still not formating properly:
output:
156976 ./447_tools
234512 ./AMIS_Scripts
16324 ./CurrentCollectorResendTool
16952340 ./Incoming
4 ./Mail
204 ./OLD_AMIS_Scripts
206016 ./Outgoing
50682604 ./Processed
132628 ./Reports
4 ./arch_logs
10796 ./bin
20212 ./conf
136 ./doc
2107252 ./done_processing
141352 ./lib
6120932 ./logs
28 ./ssh
68 ./svmon_output
11396 ./temp
129692 ./tools
Could you post your output using the code-tags? 'Cause I see tabs in your output when I look at the sites source.
i have edited it. below is what i want:
28 ssh
206016 Outgoing
16125380 Incoming
4 Mail
141352 lib
136 doc
50679708 Processed
204 OLD_AMIS_Scripts
11396 temp
129692 tools
156976 447_tools
4 arch_logs
68 svmon_output
20212 conf
2107252 done_processing
16324 CurrentCollectorResendTool
132628 Reports
234268 AMIS_Scripts
10796 bin
6083392 logs
Have a look into printf. It's available in the shell and awk.
could able to get the use of printf here. what i want is that the directory name should be aligned rowwise
also i tried the below command using col command but not so successfull:
ls -ltr | grep ^d | awk '{print $9}' | xargs du -sk | col -bx
output:
28 ssh
206016 Outgoing
17477020 Incoming
4 Mail
141352 lib
136 doc
50685612 Processed
204 OLD_AMIS_Scripts
11396 temp
129692 tools
156976 447_tools
4 arch_logs
68 svmon_output
20212 conf
2107252 done_processing
16324 CurrentCollectorResendTool
132628 Reports
10796 bin
6133036 logs
234516 AMIS_Scripts
As i see 2 directory are not aligned in a proper column i.e. ( "Incoming" and "Processed" )
I did not understand what the problem is, to use printf.
Or just use "expand" at the end of the pipeline. My solution:
find ./* -type d -prune -print | xargs du -sk | tr ' ' '\t' |expand -10
thnaks otheus your command is working perfectly. ALso a great thankfull to all those for their suggestion