Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Parsing CVS files
On Sat, 2 Feb 2019 at 21:27, Peter Stephenson
> Also, if you want to keep empty fields, you'll need the final result
> to use "${(@}this}". Probably easiest to assign to an array as otherwise
> the quotes will affect the substitution.
I've had to use "(@)" for every segment, i.e.:
% line='abc,"efg, hehe,yeah",c,,d'
% print -rl "${(@)${(@)${(@)${(z)${${line// /\\ }//,/, }}%%,}//, /,}//\\ / }"
abc
"efg, hehe,yeah"
c
d
And with a random "(@)" missing:
% print -rl "${(@)${${(@)${(z)${${line// /\\ }//,/, }}%%,}//, /,}//\\ / }"
abc "efg, hehe,yeah" c d
--
Sebastian Gniazdowski
News: https://twitter.com/ZdharmaI
IRC: https://kiwiirc.com/client/chat.freenode.net:+6697/#zplugin
Blog: http://zdharma.org
Messages sorted by:
Reverse Date,
Date,
Thread,
Author