#!/bin/sh # convert a stdin-xls file to stdout-txt # use unoconv from unoconv package # TODO: handle unoconv deadlock (set a background and timeout) tmpfile=$(tempfile --suffix=.xls) || exit 1 tmpfile2=$(tempfile --suffix=.csv) || exit 1 trap "rm -f -- '$tmpfile' '$tmpfile2'" EXIT cat >>$tmpfile unoconv -d=document -f csv "$tmpfile" "$tmpfile2" || exit 1 cat "$tmpfile2" rm -f -- "$tmpfile" trap - EXIT exit 0