Domanda

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
È stato utile?

Soluzione

May be you 're looking for the below command

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

Altri suggerimenti

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 $\\`.$'"
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top