![]() |
|
|
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 |
| not getting the output properly | pmrajesh21 | SUN Solaris | 0 | 04-16-2008 11:43 AM |
| Output in my shell isn't showing properly. | satyakide | Shell Programming and Scripting | 7 | 04-01-2008 11:05 AM |
| sort output | funksen | Shell Programming and Scripting | 9 | 01-14-2008 04:40 AM |
| how to sort and arrange an output | llsmr777 | UNIX for Dummies Questions & Answers | 10 | 11-12-2007 09:39 PM |
| How to output the results of the AT command - properly! | SpanishPassion | UNIX for Dummies Questions & Answers | 4 | 12-04-2005 10:27 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Korn: How to zero fill df output so it will sort properly
I'm looking for a way in Korn shell to zero fill (or space fill) the output from df so that it will sort properly. "Raw" output from df -k: Code:
df -k
Filesystem kbytes used avail capacity Mounted on
/dev/vx/dsk/rootvol 4131866 3593302 497246 88% /
/proc 0 0 0 0% /proc
fd 0 0 0 0% /dev/fd
mnttab 0 0 0 0% /etc/mnttab
swap 19891520 144 19891376 1% /var/run
swap 19913552 22176 19891376 1% /tmp
/dev/vx/dsk/u01 112302757 30833295 80346435 28% /u01
/dev/vx/dsk/node@1 96975 4977 82301 6% /global/.devices/node@1
/dev/vx/dsk/node@2 96975 4988 82290 6% /global/.devices/node@2
/dev/vx/dsk/stkdg/s03
1047527424 60483821 925353439 7% /s03
/dev/vx/dsk/stkdg/s02
1048576000 266754165 732957997 27% /s02
/dev/vx/dsk/sandg/s01
355923968 322572197 31422792 92% /global/s01
Sorted df output (which incorrectly sorts 28% and 27% after 7%): Code:
df -k | grep / | awk '{ print $5}' | sort -r
92%
88%
7%
6%
6%
28%
27%
1%
1%
0%
0%
0%
I would like the output to display in the following format: Code:
92% 88% 28% 27% 7% 6% 6% 1% 1% 0% 0% 0% Any ideas? |
|
||||
|
System Shock, >>A quick look at the man pages would've given you the answer. I don't think so: Code:
df -k | grep / | awk '{print $5}' | sort -gr
sort: illegal option -- g
usage: sort [-cmu] [-o output] [-T directory] [-S mem] [-z recsz]
[-dfiMnr] [-b] [-t char] [-k keydef] [+pos1 [-pos2]] files...
|
|
|||||
|
Quote:
..well, obviously you are running at the very least a different version of sort because it works for me; you didn't specify an OS or sort version. In any case, it still stands that a quick look at the man pages of whatever OS and sort version you are using would've given you the answer. |
![]() |
| Bookmarks |
| Tags |
| linux |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|