Last active
August 29, 2015 14:00
-
-
Save l0neranger/ae8770d90c192aa5e6a0 to your computer and use it in GitHub Desktop.
Convert a tab de-limited mysql export to csv
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Strategy: | |
# Remove all double quotes. | |
# Replace all tabs with double-quotes on either side of a comma. | |
# Add double-quotes to the beginning and the end of the line. | |
# Debian | |
sed -e 's/\"//g' -e 's/\t/\",\"/g' -e 's/^/\"/' -e 's/$/\"/' filename.tab > filename.csv | |
# OS X: The \t needs to be replaced by CTRL+v followed by a tab. | |
sed -e 's/\"//g' -e 's/ /\",\"/g' -e 's/^/\"/' -e 's/$/\"/' filename.tab > filename.csv |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment