Z to gz On The Fly
Z2gz() { for Z in *.Z do gz="${Z%.Z}.gz" uncompress < $Z | gzip > $gz touch -r $Z $gz getfacl $Z | setfacl -f - $gz rm -f $Z done }
Z2gz in action. In this exercise, we saved 11,970,771 bytes
$ ls -l *.Z -rw------- 1 chihung chihung 5278987 Feb 2 2009 apache.tar.Z -rw-r----- 1 chihung chihung 1479993 Aug 27 09:29 freetype-2.3.1-sol10-sparc-local.Z -rw-r----- 1 chihung chihung 25318755 Feb 2 2009 ganglia.tar.Z -rw-r----- 1 chihung chihung 797471 Aug 27 09:29 libgcc-3.4.6-sol10-sparc-local.Z -rw-r--r-- 1 chihung chihung 4039745 Feb 19 2009 mediawiki-1.6.12.tar.Z $ Z2gz $ ls -l *.gz -rw------- 1 chihung chihung 3641373 Feb 2 2009 apache.tar.gz -rw-r----- 1 chihung chihung 1019829 Aug 27 09:29 freetype-2.3.1-sol10-sparc-local.gz -rw-r----- 1 chihung chihung 16940517 Feb 2 2009 ganglia.tar.gz -rw-r----- 1 chihung chihung 527891 Aug 27 09:29 libgcc-3.4.6-sol10-sparc-local.gz -rw-r--r-- 1 chihung chihung 2814570 Feb 19 2009 mediawiki-1.6.12.tar.gz
Labels: shell script, Solaris