- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: size calc
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-22-2006 10:28 PM
06-22-2006 10:28 PM
size calc
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-22-2006 10:32 PM
06-22-2006 10:32 PM
Re: size calc
ls -l *.Z | awk '{tot+=$5} END {print "Total size =",tot/1024,"KB"}'
Regards,
Ninad
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-22-2006 10:44 PM
06-22-2006 10:44 PM
Re: size calc
The bearer of bad news, me will tell there is no way to accurately predict how the files will compress. That depends on how compressible the data is in the files.
Any attempt to predict accurately the size of the resultant file will fail.
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-22-2006 11:30 PM
06-22-2006 11:30 PM
Re: size calc
top=0
for f in *.Z
do
size=`(ls -l $f | tr -s ' ' | cut -f5 -d' ')`
top=`expr $top + $size`
done
echo "total bytes of compressed files=" $top
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-22-2006 11:54 PM
06-22-2006 11:54 PM
Re: size calc
I think you want to know wether the filesystem is able to hold all the files after uncompressing:
You won't be able to do this without really uncompressing each of them.
You can do an uncompress of one file and permanently check, if your freespace is big enough to hold the next.
I suggest something like that in ksh:
[ -d dir4flatfiles ] || mkdir dir4flatfiles
typeset -i free sz hog=100000
# you can set the factor statically or compute one dynamically as max(uncompr_size/compr_size)
for z in *.Z
do
sz=$(ls -s $z | awk -v factor=1.5 '{print $1*2*factor}')
free=$(bdf dir4flatfiles | awk 'NR>1 && NF>3 {print $(NF-2)}')
if [ free -gt sz+hog ]
then uncompress <$z >dir4flatfiles/${z%.Z}
else
print -u2 insufficient space for uncompress: $free
break
fi
done
mfG Peter
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-23-2006 12:15 AM
06-23-2006 12:15 AM
Re: size calc
#!/usr/bin/sh
# ./zcatsz.sh
for f in *.Z
do
echo $f $(zcat $f | wc -c) bytes
done
If you want the total size, pipe the script through awk:
./zcatsz.sh | awk '{t+=$2} END {print t "bytes"}'
PCS