From: Stu Date: 2011-05-17T02:52:14+09:00 Subject: Re: Linux utility with reverse index facility? Without knowing what the format is it is very hard to answer your question. Creating your own index is simple as using wc and simulating an array via carriage returns though a loop. Adding your own counter really is trivial though. As it's been pointed out many commands have a numbered option to deploy numbering if you don't want to set up the loop yourself. Example would be less -N or cat -n as well as grep. (don't use cat please =) ) The most focused command for line numbering is nl. cut works wonders for this type of project. example simulating a textfile with ruby hash: % echo "{:one=>1, :two=>2, :three=>3, :four=>4}" | cut -d"," -f 1,4 {:one=>1, :four=>4} simulating multiline textfile with hash shorthand: % echo "one:1,two:2,three:2,four:4\nfive:5,six:6,seven:7,eight:8" | cut -d"," -f 1,4 one:1,four:4 five:5,eight:8 Is this what your looking for? ~Stu On Mon, May 16, 2011 at 5:42 AM, 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' ? > > == TIA. > > >