From: Colin Patrick McCabe Date: Mon, 15 Feb 2010 22:19:31 +0000 (-0800) Subject: Add ascii-tyrant.sh X-Git-Url: http://club.cc.cmu.edu/~cmccabe/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7c80bd8c80220222b240e2fa2daaa8e4a57a5f53;p=cmccabe-bin Add ascii-tyrant.sh ascii-tyrant.sh strips non-ascii characters from text files. --- diff --git a/ascii-tyrant.sh b/ascii-tyrant.sh new file mode 100755 index 0000000..828e944 --- /dev/null +++ b/ascii-tyrant.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +# 1. translate curly single quotes into regular single quotes +# 2. translate other kind of curly single quotes into regular single quotes +# 3. translate em-dashes into '--' +# 4. translate curly start double quotes into regular double quotes +# 5. translate curly end double quotes into regular double quotes +cat | \ +sed "s/\xe2\x80\x98/'/" | \ +sed "s/\xe2\x80\x99/'/" | \ +sed "s/\xe2\x80\x93/--/" | \ +sed 's/\xe2\x80\x9c/"/' | \ +sed 's/\xe2\x80\x9d/"/' | \ +cat - +