Skip to content

Instantly share code, notes, and snippets.

@becxer
Created May 25, 2015 03:39
Show Gist options
  • Save becxer/6a65e06bcab6fd202ee9 to your computer and use it in GitHub Desktop.
Save becxer/6a65e06bcab6fd202ee9 to your computer and use it in GitHub Desktop.
convert_encoding.sh (convert files encoding batch)
#!/bin/bash
FROM=UTF-16
TO=UTF-8
ICONV="iconv -f $FROM -t $TO"
# Convert
find ./ -type f -name "*.txt" | while read fn; do
cp ${fn} ${fn}.bak
$ICONV < ${fn}.bak > ${fn}
rm ${fn}.bak
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment