![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| iptables assistance | beaker457 | IP Networking | 1 | 02-12-2009 05:03 PM |
| How is use sselect statement o/p in insert statement. | nkosaraju | Shell Programming and Scripting | 2 | 08-06-2008 10:26 PM |
| If statement - How to write a null statement | april | Shell Programming and Scripting | 3 | 04-16-2008 02:14 PM |
| I need an assistance | mytilini boy | Shell Programming and Scripting | 1 | 05-25-2007 09:42 PM |
| Need Assistance | yahoo14 | UNIX for Dummies Questions & Answers | 1 | 06-08-2006 11:21 AM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
AWK statement formatting assistance
I am writing a script that ssh's out to our various servers and extracts diskspace info to generate into a report. With the mix of servers linux/solairs 8-10/AIX the easiest way is to use df -k (though I much rather prefer df -h). I have pasted the relevant code: Code:
dfdata=`ssh -q -o ConnectTimeout=10 rkruck@$host df -k `
if (( $? == 0 ))
then
echo "$dfdata" | \
grep "/dev/" | \
egrep ' 9[0-9]%| 100%' | \
awk '{printf "%-16s %4s %6.2f %s\n"
, H, $5, $4/ 1024, $6}' H=$host >> $RDIR/diskspace.$RDATE
I get the right output, but am having trouble formatting the 3rd colum lining up so it's right justfied with the 2 decimal places lining up so it looks like the following: Code:
hostname1 91% 1809.53 /u01 hostname2 95% 1196.00 /u02 hostname3 99% 209.20 /u04 hostname4 97% 734.77 /u03 hostname5 98% 448.74 /u08 hostname6 94% 1214.33 /u07 hostname7 100% 188.25 /u05 hostname8 95% 1053.51 /u09 hostname9 94% 4232.70 /d02 hostname10 91% 6424.62 /d01 hostname11 99% 24354.89 /ora05 hostname12 90% 643.86 /home Any help is appreicated. Robert Last edited by rkruck; 08-27-2009 at 04:53 PM.. Reason: fixed formatting from code tags |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|