Skip to content

Instantly share code, notes, and snippets.

@gonzalo-bulnes
Last active March 10, 2017 03:49
Show Gist options
  • Save gonzalo-bulnes/89906945958eb6ecae7d9b837161ec03 to your computer and use it in GitHub Desktop.
Save gonzalo-bulnes/89906945958eb6ecae7d9b837161ec03 to your computer and use it in GitHub Desktop.
Convert a CSV file with Windows (or broken) encoding to Unix encoding (including end of line characters).
# Convert input with Windows (or broken) encoding to Unix encoding (including end of line characters).
#
# Usage:
#
# cat windows.csv | ./convert.sh > unix.csv
# Convert encoding to UTF-8
iconv -f iso-8859-1 -t utf-8 < /dev/stdin | \
# Remove the broken line endings (or the unnecessary carriage returns)
tr -d "\r"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment