سؤال

How can I remove the ./ on du when I do du on command line

[me@mazaredo 11]# du  --max-depth=1 
96  ./mazaredo
96  ./mazaredo1
1982340 ./mazaredo2
10532   ./mazaredo3
2165964 ./mazaredo4
18764968    ./mazaredo5
هل كانت مفيدة؟

المحلول

May be you 're looking for the below command

du --max-depth=1 | sed s@\./@@g

نصائح أخرى

I used du -m --max-depth=1 | sed 's/[./]//g'

Thanks for replies!

You can achieve by using tr command as follows

du  --max-depth=1 | tr './' ' '

You can't instead need to modify code of du command

If you are looking solution in one line, then this will help

 du --max-depth=1 | perl -n -e "/\\.\\// && print $\\`.$'"
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top