Replace comma with new line in a text file using tr in Linux

If you have a CSV file and want to replace each comma with a carriage return or new line in Linux, you can do so using the tr command. Below is an illustration of how it can be done.

Open a terminal window, then type the following command.

$ cat mycsvfile.txt | tr ',' 'n' > aaa.txt <enter>

This command is useful to convert a list of email address received in the To, cc, bcc fields of an email.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s