How can I grep or cut the "173G" under "Verf"?
I need this for Unix scripting in school.
jonas@jonaspc:~/$ df -h /dev/sda2
Dateisystem Größe Benutzt Verf. Verw% Eingehängt auf
/dev/sda2 293G 121G 173G 42% /media/Windows
cutgrepscripting
How can I grep or cut the "173G" under "Verf"?
I need this for Unix scripting in school.
jonas@jonaspc:~/$ df -h /dev/sda2
Dateisystem Größe Benutzt Verf. Verw% Eingehängt auf
/dev/sda2 293G 121G 173G 42% /media/Windows
Best Answer
The most comfortable solution for such task is
awk
:Or if more partitions are listed, you can pick the right line by the mount point:
Is also simple with
sed
, but less nice if you need to debug it a few mounts later :That supposes GNU
sed
. POSIX compatible syntax includes many escaping: