From: Robert Nichols Date: 2011-05-18T12:55:28+09:00 Subject: Re: Linux utility with reverse index facility? On 05/16/2011 05:38 AM, no.top.post@gmail.com wrote: > awk&stuff can "give me the the Nth element", > but, without writing your own search-loop, > what can "give me the index of the 'element' > which is" ? > > I think it's called 'reverse indexing' ? In awk, it's just as easy to build an array where your "elementValues" are the indices and the values stored in the array are ordinal numbers. I,e., instead of myArray[n++] = "cheese" have myArray["cheese"] = n++ Now you can use myArray["something"] in an expression and get back the number that was stored for that string (or a null string equivalent to arithmetic 0 if that index was never stored). -- Bob Nichols AT comcast.net I am "RNichols42"