home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
norge.freeshell.org (192.94.73.8)
/
192.94.73.8.tar
/
192.94.73.8
/
pub
/
sdf
/
historical
/
unpost.sh
< prev
next >
Wrap
Linux/UNIX/POSIX Shell Script
|
1995-01-27
|
1KB
|
73 lines
#!/bin/sh
#
# get uudecode items from inputlist
# -o is name of output file will be appended to
# - is from standard input
#
# all boils down to reading standard input anyway
# and writing standard output
#
CMD=$0 ;
if [ "$*". = "." ]
then
exec $CMD -
fi
argc=0
for a in $*
do
if [ ${next-0} -eq 1 ]
then
out=$a;
next=2;
continue;
fi
case $a in
-o) next=`expr ${next-0} + 1 `;;
*) if [ -r $a ]
then
args="${args}${args+"" ""}$a"
else
echo $CMD: "Can't read $a" 1>&2
status=1;
fi
argc=`expr ${argc-0} + 1`
;;
esac
done
if [ ${out-.} != "." ]
then
$CMD ${args-} >>$out
exit $?
fi
if [ ${argc-0} -ne 0 -a "${args-.}" = "." ]
then
exit $status
fi
/usr/bin/awk 'BEGIN{
on=0;
mode=0;
copy=0;
ALLOW=" !\"#$%&'"'"'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`";
}
/^BEGIN/{mode = 1 ; copy = 1 ;next; }
/^END/{if ( mode == 1 ) copy = 0 ;next;}
mode == 1 && copy == 1 {print $0 ; next; };
mode == 1 { next;}
NF == 3 && /^begin /{print $0;on=1;next;};
on == 1 && /^end/{on=0;if( space) printf("\n");printf("%s\n",$0);next;}
on == 1 {
if( length($0) == 0 ){
space=1;
next;
}else space=0;
}
on != 1{ next;}
on != 1 ||/^--/||/^ /||/[a-z{|}]/{next;}
{print $0;}
' $args
status=`expr ${status-0} + $?`
exit $status