I have my filesystem as like below
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/rootvg-rootvol
20G 3.7G 15G 20% /
tmpfs 71G 8.0K 71G 1% /dev/shm
And my code is as below:
varone = df -h | awk ' {print $1 }'
vartwo = df -h | awk ' NR == 2 {print $2","$3","$4","$5","$6 }'
echo "$varone $vartwo" >> /home/jeevagan/test_scripts/sizes/excel.csv
I want to export the 'df -h
' into a csv file. Why I printed $1
alone in one variable means, there is space in the 'df -h
' output. I want it to be printed in a single line.
When I run the script, it throws an error like
varone: command not found
vartwo: command not found