> RH9
>
> Have a php page and I want the outcome of
>
> du -hs /var/spool/imap/$username | awk '{print $1}'
>
> however, username is (say) joe.user.example.com but the directory is
> joe^user^example^com
>
> Any sed or awk experts help me do this in one line?  The output is
> simply the amount of space used by the user.

The answer may not be sed or awk, but tr.  Here's a quick test script I
wrote up (I'm sure that somebody could improve upon it):

#!/bin/bash

USERNAME="joe.user.example.com";

du -sh /var/spool/imap/`echo -e $USERNAME | tr [.] [^]` | awk '{print $1}'

HTH

Ben



-- 
redhat-list mailing list
unsubscribe mailto:[EMAIL PROTECTED]
https://www.redhat.com/mailman/listinfo/redhat-list

Reply via email to