in reply to Add Quotes to entries in a file

$ echo "ABC;123;;;;;HELLO; DEF;345;;BANANA;12DEF;44,55;4*12;;;;;;;;3;" | perl -lpe's/;\K([^;]*)/" +$1"/g' ABC;"123";"";"";"";"";"HELLO";"" DEF;"345";"";"BANANA";"12DEF";"44,55";"4*12";"";"";"";"";"";"";"";"3"; +""

Replies are listed 'Best First'.
Re^2: Add Quotes to entries in a file
by AnomalousMonk (Archbishop) on Jul 12, 2018 at 19:12 UTC

    This also produces an extraneous "" field at the end of the string that niseus seems not to want; see this. The regex just needs another look-ahead to fix the problem (if it's actually a problem); see this.


    Give a man a fish:  <%-{-{-{-<