Skip to content

Instantly share code, notes, and snippets.

@Gabri
Last active November 28, 2020 08:48
Show Gist options
  • Save Gabri/1326a19498db13ae31474b8d0ca07840 to your computer and use it in GitHub Desktop.
Save Gabri/1326a19498db13ae31474b8d0ca07840 to your computer and use it in GitHub Desktop.
[Sed] substitutions replace #replace #substitution #sed
# sostituisco alcuni caratteri non correttamente visualizzati leggendo dal primo file e genrandone uno nuovo di output
sed -e 's/è/è/g' -e 's/“/\"/g' -e 's/â€<9d>/\"/g' -e 's/ì/ì/g' -e 's/°/°/g' -e 's/ò/ò/g' testcharset.txt > testcharset_utf8.txt
# directly replace on file
sed -i -e 's/è/è/g' -e 's/“/\"/g' -e 's/”/\"/g' -e 's/’/\'/g' -e 's/â€<9d>/\"/g' -e 's/ì/ì/g' -e 's/°/°/g' -e 's/ò/ò/g' -e 's/È/E\'/g' -e 's/à/à/g' -e 's/–/-/g' gabri_nueter-20201107.sql
# for SQL import with escaping
sed -e 's/è/è/g' -e 's/é/è/g' -e 's/â€/\"/g' -e 's/“/\"/g' -e 's/’/\\\\\'/g' -e 's/Õ/\\\\\'/g' -e 's/â€<9d>/\"/g' -e 's/ì/ì/g' -e 's/°/°/g' -e 's/ò/ò/g' -e 's/È/É/g' -e 's/á/à/g' -e 's/à/à/g' -e 's/à /à/g' -e 's/ù/ù/g' -e 's/–/-/g' gabri_nueter-20201107.sql > gabri_nueter-20201107_UPD.sql
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment