> If you have a mixture of text and binary files, I don't
> know what would happen to the binary files.

A long time ago I wrote a script to run on USS and unpax based on file
"extension".
It's kludgy I know, but it seemed to work:

   # cat /usr/local/bin/ext
   function usage
   {
     echo "Usage: `basename $0` [-v] archive"
     echo "  where 'archive' is a tar/pax file"
     echo "        -v - verbose mode"
     echo ""
     echo "Extract files from archive as text and re-extract binary files
   with suffixes:"
     echo ".ico .bmp .jpg .gif .Z .gz .tzg .class"
     exit
   }

   paxFlags="-rf"
   if [ $# -eq 0 -o $# -gt 2 ]; then
     usage
   elif [ $# = 2 ]; then
     if  [ $1 = "-v" ]; then
       paxFlags="-rvf"
     fi
     shift
   fi

   # first extract with conversion
   if [ "$paxFlags" = "-rvf" ]; then
     echo "extracting with -o to=IBM-1047,from=ISO8859-1 flag ..."
     echo "------------------------------------------------------"
   fi
   pax $paxFlags $1 -o to=IBM-1047,from=ISO8859-1

   # capture the names of all binary files
   binaryFiles=`pax -f $1 | awk
   '/.ico$|.bmp$|.jpg$|.gif$|.Z$|.gz$|.tgz$|.class$/ {print $0}'`

   # re-extract binary files with no conversion
   if [ $binaryFiles ]; then
     if [ "$paxFlags" = "-rvf" ]; then
       echo "re-extracting the following in binary ..."
       echo "-----------------------------------------"
       echo "$binaryFiles"
     fi
   else
     echo "No binary files found"
   fi
   pax -rf $1 $binaryFiles 2>/dev/null

You might modify it to go in the opposite direction.

          -Mike MacIsaac, IBM  mikemac at us.ibm.com   (845) 433-7061

Reply via email to