Create an Excel or CSV file in Bash

Home > Search
  by

Redirection is all that is needed to create a CSV file in a bash shell script. In this example, a CSV file named example.csv is created, and the text Hello World will be in cell A1 of the CSV file.

~]# echo "Hello World" > example.csv

 


Comma separate

The data in a CSV file is often separated by a comma. Simply placing a comma between Hello and World will separated the data with a comma.

~]# echo "Hello,World" > example.csv

 


Tab separate

The column command can be used to create a tab separated CSV file. In this example, the data in the example.csv file is comma separated, and then a new CSV file named tab.csv is created.

~]# column -t example.csv > tab.csv



Add a Comment




We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.




Please enter in the box below so that we can be sure you are a human.




Comments