On Fri 31 May 2024 at 16:03:22 (-0400), Greg Wooledge wrote:
> On Fri, May 31, 2024 at 09:18:03PM +0200, Franco Martelli wrote:
> > On 31/05/24 at 02:18, Greg Wooledge wrote:
> > > Confusing and useless.  I still don't have a better answer than this:
> > > 
> > > hobbit:~$ tree --du -Fh /tmp/x | grep /$
> > > [7.8M]/tmp/x/
> > > └── [4.0K]  y/
> > 
> > It could be improved adding the "-a" switch to show also the hidden
> > directories and the "--color" switch to the "grep" command but this sadly
> > doesn't show the expected result (colorized directories) I don't know why:
> > 
> > ~$ tree --du -Fah /tmp/x | grep --color /$
> 
> You're only coloring the trailing / characters.  If you want everything
> from after the last space to the end of the line, you'd want:
> 
>     tree --du -Fh /usr/local | grep --color '[^[:space:]]*/$'
> 
> Of course this fails to colorize the entire directory name if there's
> a space in it.

If a coloured ] is unimportant, I suppose you could use:

  tree --du -Fh whatever | grep --color '][[:space:]][[:space:]].*/$'

Cheers,
David.

Reply via email to