Am 16.05.2011 12:38, schrieb no.top.post / gmail.com:
> 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<elementValue>" ?

You are not very clear about your actual data format.

If you have your data one per line and index is the lineno

   # NR'th element
   awk 'NR == requestedLineNumber' inputfile

   # reverse (NR of requested content, match)
   awk '/requestedContent/ { print NR }' inputfile

   # reverse (NR of requested content, equals)
   awk '$0 == "requestedContent" { print NR }' inputfile

If you have your data in an array you can also use awk to do
the reverse index lookup. (Waiting for your clarifications
about your actual case.)

Janis

>
> I think it's called 'reverse indexing' ?
>
> == TIA.
>

[set f'up-to comp.lang.awk]