I have a txt file:
,"Hi, I am Tom",,"16"
"I3","Hi, I am Jerry","Mouse","17"
in which the file is UTF-8. What I'm trying to do is to replace the commas with | except for the ones in quotes "". So the new resulting txt file would be:
|"Hi, I am Tom"||"16"
"I3"|"Hi, I am Jerry"|"Mouse"|"17"
I do not have much knowledge on sed or awk script but i heard it can be used to accomplish this. Could anyone show me how it's done?
|
and, if so, what do you want done with that? Can they contain newlines? Can they contain escaped double quotes, e.g."foo""bar"
or"foo\"bar"
? – Ed Morton Mar 07 '20 at 17:29