Re: Sorting elements *and* knowing where each one has been put

2010-01-30 Thread Merciadri Luca
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Clive Standbridge writes: >> > 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

Re: Sorting elements *and* knowing where each one has been put

2010-01-30 Thread Merciadri Luca
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 "Boyd Stephen Smith Jr." writes: > In <87mxzvg816@merciadriluca-station.merciadriluca>, Merciadri Luca wrote: >>"Boyd Stephen Smith Jr." writes: >>> nl values | sort -k2 | nl | grep value_i >>> >>> The first column is the new location, 1-based.

Re: Sorting elements *and* knowing where each one has been put

2010-01-30 Thread Boyd Stephen Smith Jr.
In <87mxzvg816@merciadriluca-station.merciadriluca>, Merciadri Luca wrote: >"Boyd Stephen Smith Jr." writes: >> nl values | sort -k2 | nl | grep value_i >> >> The first column is the new location, 1-based. The second column is the >> old location, 1-based. If your values are numbers, you mig

Re: Re: Sorting elements *and* knowing where each one has been put

2010-01-30 Thread Clive Standbridge
> > 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

Re: Sorting elements *and* knowing where each one has been put

2010-01-30 Thread Merciadri Luca
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 "Boyd Stephen Smith Jr." writes: > nl values | sort -k2 | nl | grep value_i > > The first column is the new location, 1-based. The second column is the old > location, 1-based. If your values are numbers, you might use (awk '$3 == > value_i') ins

Re: Sorting elements *and* knowing where each one has been put

2010-01-30 Thread Merciadri Luca
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Lee Winter writes: > In the discussion above you persist in mixing the sort function with > the sort command. They are not the same, so please be more careful in > your descriptions of what it is you want to accomplish. > > To sort with a function,

Re: Sorting elements *and* knowing where each one has been put

2010-01-29 Thread Boyd Stephen Smith Jr.
On Friday 29 January 2010 17:08:00 Merciadri Luca wrote: > I have some numerical values, i.e. something like > > == > value_1 > value_2 > . > . > . > value_n > == > > There are many ways to sort them, but the `sort' command is clearly > appropriate. > > The problem is that I need to know where v

Re: Sorting elements *and* knowing where each one has been put

2010-01-29 Thread Lee Winter
On Fri, Jan 29, 2010 at 6:08 PM, Merciadri Luca wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > Hi, > > I have some numerical values, i.e. something like > > == > value_1 > value_2 > . > . > . > value_n > == > > There are many ways to sort them, but the `sort' command is clearly > app

Re: Sorting elements *and* knowing where each one has been put

2010-01-29 Thread T o n g
On Sat, 30 Jan 2010 00:08:00 +0100, Merciadri Luca wrote: > The problem is that I need to know where value_i is, before, and after, > the sorting. Is this homework? -- Tong (remove underscore(s) to reply) http://xpt.sourceforge.net/techdocs/ http://xpt.sourceforge.net/tools/ -- To UNSUBS

Sorting elements *and* knowing where each one has been put

2010-01-29 Thread Merciadri Luca
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi, I have some numerical values, i.e. something like == value_1 value_2 . . . value_n == There are many ways to sort them, but the `sort' command is clearly appropriate. The problem is that I need to know where value_i is, before, and after, the s