* Writing element number into element, of array
@ 2017-03-06 15:07 Sebastian Gniazdowski
2017-03-06 16:21 ` Daniel Shahaf
0 siblings, 1 reply; 2+ messages in thread
From: Sebastian Gniazdowski @ 2017-03-06 15:07 UTC (permalink / raw)
To: zsh-users
Hello,
# line=0
# arr=( "a" "ba" "x-LINE-x" "dcba" )
# echo ${arr[@]//(#b)(((*)-LINE-(*))|(*))/$match[3]$(( mend[2] != -1 ?
++ line : ( ++line, 0 ) ))$match[4]$match[5]}
$mend[2] is: ((*)-LINE-(*))
$match[3] is: first (*)
$match[4] is: second (*)
$match[5] is: |(*)
result:
0a 0ba x3x 0dcba
So this is quite close, "3" is written onto -LINE-, but I cannot get rid
of the "0". How can this be done?
--
Sebastian Gniazdowski
psprint3@fastmail.com
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-03-06 16:26 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-06 15:07 Writing element number into element, of array Sebastian Gniazdowski
2017-03-06 16:21 ` Daniel Shahaf
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).