Smart quote character replacement for those with deficient sed-fu.
smitty1e at gmail.com
Sun Jun 17 03:39:42 CEST 2012
1. OSX 10.7, bunch of .tex files culled from a blog via some cruddy old Perl script.
.tex files are utf-8 encoded, which means the quotes and apostrophes drop out going through pdflatex.
2. Recommend using git to manage the .tex files, which are all in a /src directory in the project. If you're going to do batch edits, You Will Need to branch, realize you gooned up, and roll back.
3. Understood, sed is the more classical tool here, except that I could not it to work in my OSX terminal.
python charfix.py `ls src/*.tex`
# -*- coding: utf-8 -*-
print line.replace( "’", "'" ).replace( "“", '"' ).replace( "”", '"' )
for line in fileinput.input( inplace=1 ):
Thank you, python!
More information about the Python-list