Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: line continuation with sed
- X-seq: zsh-users 28203
- From: Marc Chantreux <mc@xxxxxxxxxx>
- To: Ray Andrews <rayandrews@xxxxxxxxxxx>
- Cc: Zsh Users <zsh-users@xxxxxxx>
- Subject: Re: line continuation with sed
- Date: Fri, 14 Oct 2022 12:57:01 +0200
- Archived-at: <https://zsh.org/users/28203>
- Dkim-filter: OpenDKIM Filter v2.10.3 zmtaauth03.partage.renater.fr 914DF80071
- In-reply-to: <9184bbff-9e68-7b02-2595-3474b016dfff@eastlink.ca>
- List-id: <zsh-users.zsh.org>
- References: <9184bbff-9e68-7b02-2595-3474b016dfff@eastlink.ca>
hello Ray,
I don't know about the \ problem (maybe you should provide a real
non-working example so we can play ourselves: setting variables,
having working substitions ...)
also: here are some workarounds:
a) is there a reason not to use what I believe to be the common way to do it?
var=$( print -l $var | sed -r '
s/.../.../
s/.../.../
s/.../.../
s/.../.../
')
b) why not embbed in a function?
a and b are not exclusive, you can write
substitute_things() sed -r '
s/.../.../
s/.../.../
s/.../.../
s/.../.../
'
var=$( print -l $var | substitute_things )
c) dig into a pure zsh substitution ?
I imagine $var is an array as you use print -l so
var=( those_are long_words )
print -l ${var/???/AAA}
gimme
AAAse_are
AAAg_words
HTH
--
Marc Chantreux
Pôle de Calcul et Services Avancés à la Recherche (CESAR)
http://annuaire.unistra.fr/p/20200
Messages sorted by:
Reverse Date,
Date,
Thread,
Author