How do I convert a tab-separated values (TSV) file to a comma-separated values (CSV) file in BASH?

后端 未结 4 1170
闹比i
闹比i 2021-02-03 14:07

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,

4条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-02-03 14:31

    The tr command :

    tr '\t' ',' < file.tsv > file.csv
    

    is simple and gave absolutely correct and very quick results for me even on a really large file (approx 10 GB).

提交回复
热议问题