Scenario
I am trying to use cut command to get the 4th field from a file that has the redirected output of a df command. But it's only cutting and returning the 1st field for some reason.
df -kh -B 1g /ws/abc-Location03 > file1.txt
cut -d" " -f4 file1.txt
Output of my df command
Filesystem 1G-blocks Used Available Use% Mounted on
abc5-xyz04c:/root_vdm_6/t2local24/abc-Location03
500 408 93 82% /ws/abc-Location03
Output of my cut command
abc5-xyz04c:/root_vdm_6/t2local24/abc-Location03
Basically, it's cutting just the 1st field and returning it, instead of the 4th field. I 'd like to know what it is I'm doing wrong.
You can use awk
instead:
df -kh -B 1g /ws/abc-Location03 | awk '{print $4}'