I am trying to grab the 3rd to the last column in the "df -m" command but it does not seem to work. Well its works on one and does not work on other. Part of the reason is for one mount point we are using LVM and other we are using standard linux mount...
But i need to always access the 3rd to the last column(Available space) so i can make sure my script works...how can this be achieved or what am i doing wrong ?
hostname:oraSID 292> df -m /oracle/SID/logs/
Filesystem 1M-blocks Used Available Use% Mounted on
/dev/xvdf 5040 1139 3646 24% /oracle/SID/logs
hostname:oraSID 293>
hostname:oraSID 293> df -m /oracle/SID/sapdata6/
Filesystem 1M-blocks Used Available Use% Mounted on
/dev/mapper/grp1-log_vsap1
856743 800202 13022 99% /oracle/SID/sapdata6
hostname:oraSID 294>
hostname:oraSID 294>
hostname:oraSID 295> df -m /oracle/SID/logs/ | awk '{ field = $(NF-2) }; END{ print field }'
3646
hostname:oraSID 296>
hostname:oraSID 296> df -m /oracle/SID/sapdata6/ | awk '{ field = $(NF-2) }; END{ print field }'
awk: (FILENAME=- FNR=2) fatal: attempt to access field -1
hostname:oraSID 297>
hostname:oraSID 297>