Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Any easier way of parsing this file?
- X-seq: zsh-users 9524
- From: DervishD <zsh@xxxxxxxxxxxx>
- To: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- Subject: Re: Any easier way of parsing this file?
- Date: Wed, 19 Oct 2005 09:37:48 +0200
- Cc: Zsh Users <zsh-users@xxxxxxxxxx>
- In-reply-to: <1051019015810.ZM32176@xxxxxxxxxxxxxxxxxxxxxxx>
- Mail-followup-to: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>, Zsh Users <zsh-users@xxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- Organization: DervishD
- References: <20051018225336.GA957@DervishD> <1051019015810.ZM32176@xxxxxxxxxxxxxxxxxxxxxxx>
Hi Bart :)
* Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> dixit:
> On Oct 19, 12:53am, DervishD wrote:
> }
> } The file contents are contained in a parameter (long story...),
> } and they MUST be contained in a parameter.
> }
> } Is there any better way of parsing this file using Zsh and
> } assuming that I may be interested in gathering the information for
> } other labels in the future?
>
> Use IFS. That's what it's for.
>
> print -r $data | while IFS='=' read label content
> do
> case $label in
> SOMELABEL) : ... $content ... ;;
> ANOTHERLABEL) : ... $content ... ;;
> esac
> done
Well, I was more interested in an alternative for the "print |
while read" but this is a good idea too. Less complex patterns.
Thanks a lot, Bart :)
Raúl Núñez de Arenas Coronado
--
Linux Registered User 88736 | http://www.dervishd.net
http://www.pleyades.net & http://www.gotesdelluna.net
It's my PC and I'll cry if I want to...
Messages sorted by:
Reverse Date,
Date,
Thread,
Author