I'm trying to get the fs that have high space consumed. I'm trying to do this using df
command with -g
flag (gigabyte view) and I can't obtain my expected value.
df -g | sed 's/%//g'| awk '+$5>=75 {print}' | head -10
With this command below I got an error:
df -g | sed 's/%//g'| awk '{print $5>=75}' | head -4
Error Message:
Syntax Error The source line is 1.
The error context is
{print >>> $5>= <<<
awk: 0602-502 The statement cannot be correctly parsed. The source line is 1.
Here is the output of df -g command on AIX:
/tmp>df -g | sed 's/%//g'| awk '$5 >= 75 { print }' | head -4
Filesystem GB blocks Free Used Iused Iused Mounted on
/dev/hd4 10.50 10.05 5 16492 1 /
/dev/hd2 25.50 18.15 29 64361 2 /usr
/dev/hd9var 2.50 0.72 72 4521 3 /var
Complete view:
Filesystem GB blocks Free %Used Iused %Iused Mounted on
/dev/hd4 10.50 10.05 5% 16492 1% /
/dev/hd2 25.50 18.15 29% 64357 2% /usr
/dev/hd9var 2.50 1.39 45% 4512 2% /var
/dev/hd3 21.50 20.24 6% 1495 1% /tmp
I tried on AIX 7.1 PowerPC_POWER8. I don't know what I'm doing wrong!
awk
or now, but try adding spaces? Also, your twoawk
statements are different.$5 >= 75 {print}
will print the input line if the fifth field is greater than or equal to 75;{print $5 >= 75}
will print a zero or one based on the truthiness of the inequality. – DopeGhoti Aug 23 '17 at 18:44df -g
to the text in the question. There's not many here with an AIX system at hand. Also, never say "it does not work" without also saying exactly in what way it doesn't work. – Kusalananda Aug 23 '17 at 19:02