Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: line continuation with sed



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