BASH converting txt to csv

BASH/scripting newbie here.

sed 's/ \+/,/g' output3.txt > output.csv

This one gave me so many delimited. I only one to delimit the "pipe" | symbol and leave the rest as it is. So basically, there'll be only two columns in the csv output file.

CSV file Input:

 google.com | companycode-12345

When I applied this line sed 's/ +/,/g' output3.txt > output.csv the results is:

 google.com | companycode - 12345 

What I'm looking is the following:

 google.com | companycode-12345
8

1 Answer

The problem was solved with:

sed 's/ | /,/g'
0

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like