[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

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



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Clive Standbridge <Clive.Standbridge@myriadgroup.com> 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 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" :-)
Thanks!

- --
Merciadri Luca
See http://www.student.montefiore.ulg.ac.be/~merciadri/
- -- 

The ends justify the means.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Processed by Mailcrypt 3.5.8 <http://mailcrypt.sourceforge.net/>

iEYEARECAAYFAktkYP0ACgkQM0LLzLt8MhzrLACeOxeTAvYhY3ioqk4o+MBUibmL
85sAmwb6aC6wagtjSr5E6WdU0QX83u2J
=qqci
-----END PGP SIGNATURE-----


Reply to: