I have a CSV file that contains data like so:
1, 2, 3
A, B, C
4, 5, 6
I'm trying to output this in bash as a single string separated by newlines like so:
"1, 2, 3\nA, B, C\n4, 5, 6"
I tried numerous ways but nothing has worked yet. Thanks for your help!
EDIT:
Based on answers provided, since other users of my code might need the same transformation and I can't guarantee what's on their system, still looking for answers independent of whether or not I have:
- GNU sed installed
- Windows line endings or not
- Have
dos2unix
installed