Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Per line ${..//..}
- X-seq: zsh-users 9563
- From: Peter Stephenson <pws@xxxxxxx>
- To: Zsh Users <zsh-users@xxxxxxxxxx>
- Subject: Re: Per line ${..//..}
- Date: Wed, 26 Oct 2005 10:47:58 +0100
- In-reply-to: <20051026094047.GA658@DervishD>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <20051026094047.GA658@DervishD>
DervishD wrote:
> I have a parameter containing a bunch of lines, and I have to get
> rid of comments (that is "$line" == (#s)[" $'\t'"]#\#*(#e)) and empty
> lines (that is "$line" == (#s)[" $'\t'"]#(#e)). I've tried using the
> ${..//..} syntax for doing substitutions in parameters, but with no
> success because I don't know how to properly mark the beginning and
> end of a line.
You can do something like:
% lines=(foo "# comment" bar " ")
% print -l $lines
foo
# comment
bar
% print -l ${lines:#[[:space:]]#(\#*|)}
foo
bar
pws
This message has been scanned for viruses by BlackSpider MailControl - www.blackspider.com
Messages sorted by:
Reverse Date,
Date,
Thread,
Author