From: Dominik Vogt <dominik.vogt@gmx.de>
To: zsh-users@zsh.org
Subject: Re: Parsing CVS files
Date: Tue, 5 Feb 2019 22:30:16 +0100 [thread overview]
Message-ID: <20190205213016.nzc5b4uyjg7bufx5@gmx.de> (raw)
In-Reply-To: <CAKc7PVBrpQGYQbF02XUyZKbKjTo0SjM78ykkJ=yC9k1D+yusiQ@mail.gmail.com>
On Sun, Feb 03, 2019 at 05:19:08AM +0100, Sebastian Gniazdowski wrote:
> 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
Uff, looks complicated but should fix my problem. Thanks!
Spaces and backslashes are no real problem beacause they can be
replaced with some unique character sequence before splitting.
Ciao
Dominik ^_^ ^_^
--
Dominik Vogt
prev parent reply other threads:[~2019-02-05 21:30 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-02 18:59 Dominik Vogt
2019-02-02 20:14 ` Peter Stephenson
2019-02-03 4:19 ` Sebastian Gniazdowski
2019-02-05 21:30 ` Dominik Vogt [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190205213016.nzc5b4uyjg7bufx5@gmx.de \
--to=dominik.vogt@gmx.de \
--cc=zsh-users@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).