The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 10-10-2008
hcclnoodles hcclnoodles is offline
Registered User
  
 

Join Date: Mar 2002
Posts: 272
using awk remotely

Hi there

I am trying to add up the disk space used on a remote linux box but am falling at the first hurdle i.e isolating the 'space used' column with df -k on the remote box

if i run this, i get the df -k output as expected

Code:
# rsh remote-server 'df -k|grep sd|grep -v boot' 
/dev/sda3              8254272   1672956   6162020  22% /
/dev/sdb4            140258988  13405152 119729012  11% /data
/dev/sda4            123648020     32828 117334180   1% /data1
which is fine, however I want to isolate the third column, so that i can add use some additional logic to add the values to give me a total space used by that box

so i tried

Code:
# rsh remote-server 'df -k|grep sd|grep -v boot|awk {print $3} '
awk: cmd. line:2: (END OF FILE)
awk: cmd. line:2: parse error
I tried using cut, but setting the delimiter to " " (ie space) it messes up all the columns

does anybody have any idea how i can get around this ?

any help would be great