in reply to Re: How to substitute all tabs only in a specific field
in thread How to substitute all tabs only in a specific field
"The one from Kcott "almost" worked. The double-quote fields are correct, the ones before the quotes are missing :)."
Yes, I forgot to capture the first part of the strings. Fixing that, and then making changes for your altered input and updated spec:
$ perl -pE 's/^([^"]+")([^"]+)/$1 . $2 =~ y{\t}{,}r/e' a b "x1 x2" a b "x1,x2" c d "x2" c d "x2" e f "x3 x4 x5" e f "x3,x4,x5"
"I was not able to add "tabs" in the example ..."
Surely you must mean something else. I pressed the key labelled "TAB" on my keyboard to add them to my input. Admittedly, it may not be easy to see the difference between a tab and a space, but the output gives it away:
$ perl -pE 's/^([^"]+")([^"]+)/$1 . $2 =~ y{\t}{,}r/e' a b "x1 x2" a b "x1 x2"
— Ken
|
|---|