Path: utzoo!attcan!uunet!wyse!mikew From: mikew@wyse.wyse.com (Mike Wexler) Newsgroups: comp.sources.x Subject: v02INF4: extraction shell script for hpdoc Message-ID: <1922@wyse.wyse.com> Date: 21 Dec 88 19:56:54 GMT Organization: Wyse Technology, San Jose Lines: 46 Approved: mikew@wyse.com Submitted-by: mikew@wyse.com (Mike Wexler) Posting-number: Volume 2, Info 4 Archive-name: x.sh [The extraction script that was included in the HP widgets documentation doesn't work. Here is a version that should work. -mcw] #! /bin/sh echo extracting data... /bin/awk ' BEGIN { inhex = 0 ; part = 0 } /^---/ { if ($2 == "start") part++ if ($6 != part) exit 1 if (inhex && (NF > 1)) inhex = 0 else { inhex = 1 getline } } { if (inhex) print $0 }' > /tmp/xtr$$ if test $? = 1 ; then echo 'Parts sent through out of order!! Punting.' /bin/rm -f /tmp/xtr$$ exit 1 fi echo ...finished extraction, starting uudecode... fname=`head -100 /tmp/xtr$$ | grep begin | cut -f3 -d' '` OurDir=`pwd` cd /tmp uudecode xtr$$ /bin/rm -f xtr$$ /bin/chmod 777 $fname mv $fname $fname.Z echo ...finished uudecode, starting uncompress... uncompress $fname cd $OurDir echo ...finished uncompress, starting tar extraction... tar xvf $fname /bin/rm -f /tmp/xtr* $fname -- Mike Wexler(wyse!mikew) Phone: (408)433-1000 x1330 Moderator of comp.sources.x