> > However, I do not know how I can do this with the `sort' > > function. Is > > it even possible? (I considered 1<=i<=n through the whole message.) > > nl values | sort -k2 | nl | grep value_i If you want to sort by numeric order instead of alphabetic order, you should replace sort -k2 with sort -k2n PS I learnt a new command today: "nl" which is shorter than "cat -n" :-) -- Cheers, Clive