in reply to Re: converting txt to csv and formatting
in thread converting txt to csv and formatting

Update:
This simple regex would also work under vim instead of using macro.
s/\(.*\),\(.*\)\n\(.*\)\n\(.*\)\n/"\1,\2",\3,\4\r/g
Without using vim, under Unix, you can do:
perl -e 'my $data =`cat test.pl`; $data=~s/(.*),(.*)\n(.*)\n(.*)\n/"\1 +,\2",\3,\4\n/g;print $data;'>newfile.csv
Under windows, you can do:
perl -e 'my $data =`type test.pl`; $data=~s/(.*),(.*)\n(.*)\n(.*)\n/"\ +1,\2",\3,\4\n/g;print $data;'>newfile.csv