Word konvertor
Petr Hlustik
hlustik na cortex.neurology.umaryland.edu
Čtvrtek Duben 29 22:17:32 CEST 1999
On Thu, Apr 29, 1999 at 01:18:33PM +0200, Rudolf Ulč wrote:
> Nevíte někdo jak výstup na stdout z mswordview propojit rourou do lynxu ?
Snad pomuze nasledujici radek pro .mailcap (ja to zatim nezkousel):
application/msword; mswordview %s -o - | html2ascii; lynx %s
kde html2ascii je dole. Petr.
#!/bin/sh
#
# Name: html2ascii
#
# Description:
# Convert HTML files to ascii. Makes empty lines empty.
#
# Exit Values:
# 0 Successful completion.
# 1
#
# Inputs:
# 0 or more files (stdin is read for 0 files)
#
# Outputs:
#
# Environment:
# DEBUG is list of scripts to debug
# DEBUG_log is log file for debugging output
#
# Modified by:
# 11/01/95 Howard Fear Original
#
# Notes:
# 01/01/96 Howard Fear Change LYNX to be correct on your system.
#
LYNX=/usr/local/bin/lynx
set -h # remember functions
self="`basename $0`"
die () { echo ${1:+"$self: $*"} >&2; kill -TERM $$; }
warn () { echo ${1:+"$self: $*"} >&2; }
usage () { echo "usage: $self files..." >&2; exit 1; }
: ${TMPDIR:=/tmp}
trap 'rm core >/dev/null 2>&1; exit 1' 0 15
case ":${DEBUG:=$debug}:" in
*:$self:* | :all: | :true: | :on: )
set -vx
test "$DEBUG_LOG" && exec 2>>$DEBUG_LOG
;;
esac
# use stdin if no files present
test $# -eq 0 && set -- -
for i
do
case "$i" in
- ) # process stdin
# lynx occasionally core dumps so we remove core as well
trap "rm $TMPDIR/$$.html core >/dev/null 2>&1" 0 15
touch $TMPDIR/$$.html || {
warn "Could not create $TMPDIR/$$.html"
continue
}
while read line; do echo "$line" >> $TMPDIR/$$.html; done
filename="$TMPDIR/$$.html"
;;
* ) filename="$i" ;;
esac
( $LYNX -dump $filename || die "Could not index file $filename" ) \
| sed -e 's/[ ]*$//'
echo
done
exit 0
Další informace o konferenci Linux