Skip to content

Instantly share code, notes, and snippets.

@michalvalasek
Created October 2, 2012 21:42
Show Gist options
  • Save michalvalasek/3823495 to your computer and use it in GitHub Desktop.
Save michalvalasek/3823495 to your computer and use it in GitHub Desktop.
Converts a text file from windows-1250 encoding to utf-8
#!/bin/bash
if [ "$1" == "" ]
then
echo "usage: $0 <Input file>"
exit 0
fi
if ! [ -f $1 ]
then
echo "$1 does not exits"
exit 0
fi
FROM_ENC=windows-1250
TO_ENC=utf-8
NEW_FILE_NAME=$(sed -E 's#(.txt)#.conv\1#g' <<< $1)
iconv -f $FROM_ENC -t $TO_ENC $1 > $NEW_FILE_NAME
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment