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

Writing element number into element, of array



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@xxxxxxxxxxxx



Messages sorted by: Reverse Date, Date, Thread, Author