If I have a comma separated file like the following:
foo,bar,n ,a,bc,d one,two,three ,a,bc,d
And I want to join the \n, to produce this:
foo,bar,n,a,bc,d one,two,three,a,bc,d
What is the regex trick? I thought that an if (/\n,/) would catch this.
Also, will I need to do anything special for a UTF-8 encoded file?
Finally, a solution in Groovy would also be helpful.
You should be using Text::CSV_XS instead of doing this yourself. It supports newlines embedded in records as well as Unicode files. You need to specify the right options when creating the parser, so be sure to read the documentation carefully.