Home > Blockchain >  How to remove a specific entry from a number of entries separated by comma?
How to remove a specific entry from a number of entries separated by comma?

Time:05-19

I have some entries in a csv file like below

John, 20, LA, USA
Jane, 50, NY, USA
Jim, 38, PH, USA

How can I remove the second entry from all lines in vim editor so that it looks like the following?

John, LA, USA
Jane, NY, USA
Jim, PH, USA

CodePudding user response:

This should work:

:%s/^\([^,]\ ,\) [^,]\ ,/\1/

CodePudding user response:

I would do it with the following command:

:%normal! f,dt,
  • Related