How do I convert a tab-separated values (TSV) file to a comma-separated values (CSV) file in BASH?
问题 I have some TSV files that I need to convert to CSV files. Is there any solution in BASH, e.g. using awk , to convert these? I could use sed , like this, but am worried it will make some mistakes: sed 's/\t/,/g' file.tsv > file.csv Quotes needn't be added. How can I convert a TSV to a CSV? 回答1: Update : The following solutions are not generally robust , although they do work in the OP's specific use case; see the bottom section for a robust, awk -based solution . To summarize the options