Skip to content

Instantly share code, notes, and snippets.

@tuttelikz
Last active April 26, 2018 06:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tuttelikz/53ecc6f58c41fd72b075ba322b643f1b to your computer and use it in GitHub Desktop.
Save tuttelikz/53ecc6f58c41fd72b075ba322b643f1b to your computer and use it in GitHub Desktop.
Instructions on how to convert TSV to CSV file
First, add to file and name it as csv2tab.sh the following script:
###########################################################################
#!/usr/bin/env python
import csv, sys
csv.writer(sys.stdout, dialect='excel-tab').writerows(csv.reader(sys.stdin))
###########################################################################
Then, locate your terminal to the directory where you saved .sh file and give it execution permissions with:
###########################################################################
chmod +x the_file_name
###########################################################################
After, just call the script and give your preferred filenames:
###########################################################################
./csv2tab.sh < data.csv > data.tsv && head data.tsv
###########################################################################
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment