Re: sort command

From: Clifton, Pablo (Pablo.Clifton@BCBSFL.COM)
Date: Thu Dec 12 2002 - 14:32:30 EST


I've battled that darn message in the script below and never could fix it-
so I ended up just running:

        sort +3 -n -r /tmp/foo 2>/dev/null

Here's a script below which sums up JFS filesystem usage for a server:

#!/bin/ksh

#######################################

# FILESYSTEM INFORMATION

#######################################

#Filesystem 1024-blocks Used Free %Used Mounted on

#/dev/hd4 131072 43644 87428 34% /

#/dev/hd2 3080192 2255236 824956 74% /usr

#/dev/hd9var 196608 138780 57828 71% /var

sum=0

ofile=/tmp/disk-foo

echo "\n\nFILESYSTEM Information from 'df'...\n"

printf "%-31s %9s \t\t%7s \t\t%10s\n" "Filesystem" "Total(MB)" "USED (MB)"
"FREE (MB)"

df -tk | grep "^\/dev" | awk 'BEGIN { }

        { printf ("%-31s %9d \t\t%10d \t\t%10d\n",
$6,$2/1000,$3/1000,$4/1000) }

        { tsum=tsum+$2 }

        { fsum=fsum+$4 }

        { usum=usum+$3 }

        END {

                tsum=tsum/1000000

                fsum=fsum/1000000

                usum=usum/1000000

                printf ("\n\n\t\t\tTOTAL:\t %4.1f GB", tsum )

                printf ("\t USED: %4.1f GB", usum )

                printf ("\t FREE: %4.1f GB", fsum )

            }' > /tmp/foo

sort +3 -n -r /tmp/foo 2>/dev/null | egrep -v "TOTAL|^/n"

echo "\n"

grep TOTAL /tmp/foo

echo "\n"

--
Pablo Clifton
UNIX Tech Services
> * pablo.clifton@bcbsfl.com
> * DCC603-F212
> * 904.905.7116/ 210.287.4021 cell
-----Original Message-----
From: Stephen Spalding [mailto:ssaixadm@YAHOO.COM]
Sent: Thursday, December 12, 2002 1:49 PM
To: aix-l@Princeton.EDU
Subject: sort command
Hello all,
I'm trying to run the following sort command but keep
getting an error:
sort -t~ -k 1.5,1.23 -T /apps/rs2prod/sort ./rsxrpt.36
> ./rsplitr.36
The error that I'm getting is:
sort: Warning: A newline character was added to the
end of file ./rsxrpt.36.
Anyone ever seen this? Do you know how to fix it?
Thanks!
-Stephen Spalding
__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com
Blue Cross Blue Shield of Florida, Inc., and its subsidiary and
affiliate companies are not responsible for errors or omissions in this e-mail message. Any personal comments made in this e-mail do not reflect the views of Blue Cross Blue Shield of Florida, Inc.


This archive was generated by hypermail 2.1.7 : Wed Apr 09 2008 - 22:16:24 EDT