Nalan Turner wrote: > I have a large text file which I have imported into LyX. I'd like to > replace the straight ASCII quotation marks with LaTeX left/right > quotation marks, but if I were to do them all by hand I'd be at it for > days. Is there a way to do it automatically, and still have the quotes > going in the correct direction? > > Robin
This appears to work. No promises however... Run as $ conv.sh yourfile.lyx The output will be in tmp-yourfile.lyx Incidentally, does anyone know how to escape "'" so I could have sed 's/RE//' here instead of having to use sed "s/RE//" with the ensuing nastiness of '\\\\'? Angus #! /bin/sh replacequotes () { TMP=tmp-$1 cp $1 $TMP while (grep "'" $TMP > /dev/null); do sed "s/'/\\ \\\\begin_inset Quotes eld\\ \\\\end_inset\\ \\ /" $1 | sed "s/'/\\ \\\\begin_inset Quotes erd\\ \\\\end_inset\\ \\ /" > tmp-out mv tmp-out $TMP done } test $# -eq 1 || exit 1 replacequotes $1