Knowledge Base

Preserving for the future: Shell scripts, AoC, and more

Fix smart quotes with sed

# use :help digraph and ^K in Insert Mode
# convert smart double quotes to straight double quotes
s:~@[~\|~]]:":g;
# fix smart apostrophe  
s:~@[~Y]:':g;

And run with:

sed -f fix-unicode.sed < input.txt > output.txt

This file will exist in the bgscripts repo at some point. I'm sure copy-pasting this script from this article will not work.

References

Original work

Comments