Sto cercando di convertire le virgolette singole giuste in un apostrofo usando tr.
tr "`echo -e '\xE2\x80\x99'`" "`echo -e '\x27'`" < a > b
dato un file codificato UTF-8 chiamato ache contiene questo esempio:
We’re not a different species
“All alone?” Jeth mentioned.
OS X utilizza BSD tre produce un buon risultato:
We're not a different species
“All alone?” Jeth mentioned.
Ubuntu usa GNU tre produce questo brutto risultato:
We'''re not a different species
''<9C>All alone?''<9D> Jeth mentioned.
Come posso realizzare questa conversione in Ubuntu?
echo It’s easy | perl -CS -Mutf8 -pe "tr/’/'/"