Reputation: 4429
I've a text file with thousand of lines in it (each line has an email address) and I'd like to convert those to a CSV file using bash. The problem is I'm not well versed with Bash, so not sure how to go about doing it.
Any suggestions?
EDIT: File example:
[email protected]
[email protected]
[email protected]
[email protected]
Upvotes: 1
Views: 184
Reputation: 120644
This is ugly but it should work:
while read email; do echo '"'${email//\"/\"\"}'"'; done < inputfile.txt > output.csv
This escapes "
with ""
which is how CSVs are escaped in Excel land.
Upvotes: 1