1

Kept trying various options through regex (^([^ ])., etc), but wasn't successful.

I have a comma separated file, and would like to delete the last column.

thanks

  • If you can share what exactly you have tried, then someone from community would be able to spot the error and help you – pun Dec 4 '15 at 17:41
  • Actually, I used the same which was suggested below [^,]*$, however, it only deletes the first row's last column. The issue could be that the data in the last column is long and sometimes doe snot even finish properly instead of }" , just abruptly ends. I wonder if there is a way to tall for example to delete everything after the first " ? – Tre Dec 7 '15 at 15:51
-1

A regex solution is:

,[^,]*$

Does not work for csv files with comma's between quotes in the column.

  • 1
    lookahead and lookbehind have specific meanings in regexes which don't apply to yours. It's really just looking for a comma followed by 0 or more non-commas at the end of the line. However, that doesn't work for csv's with quoted fields, for example think about what it does on column0,"column, the first". – blm Dec 3 '15 at 18:31
  • and I do have those....in the last column which should be deleted. The before columns do not have quotes. – Tre Dec 4 '15 at 11:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.