Skip to content

Instantly share code, notes, and snippets.

@CorentinGC
Created November 11, 2023 16:13
Show Gist options
  • Save CorentinGC/571fe1db56643d557db195756b105b7e to your computer and use it in GitHub Desktop.
Save CorentinGC/571fe1db56643d557db195756b105b7e to your computer and use it in GitHub Desktop.
sed replace accents (YAML)
#!/bin/bash
sed -e "s/é/\\\00E9/g" \
-e "s/è/\\\00E8/g" \
-e "s/ê/\\\00EA/g" \
-e "s/ë/\\\00EB/g" \
-e "s/É/\\\00C9/g" \
-e "s/È/\\\00C8/g" \
-e "s/Ê/\\\00CA/g" \
-e "s/Ë/\\\00CB/g" \
-e "s/à/\\\00E0/g" \
-e "s/â/\\\00E2/g" \
-e "s/À/\\\00C0/g" \
-e "s/Â/\\\00C2/g" \
-e "s/ù/\\\00F9/g" \
-e "s/û/\\\00FB/g" \
-e "s/ü/\\\00FC/g" \
-e "s/Ù/\\\00D9/g" \
-e "s/Û/\\\00DB/g" \
-e "s/Ü/\\\00DC/g" \
-e "s/ô/\\\00F4/g" \
-e "s/ö/\\\00F6/g" \
-e "s/ô/\\\00D4/g" \
-e "s/ö/\\\00D6/g" \
-e "s/\([a-zA-Z]\)'\([a-zA-Z]\)/\1''\2/g" \ # escape single quotes in text
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment