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

Re: Some shell query



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

On 28/11/11 04:53, Kousik Maiti wrote:
> Hi LIst,

hi

> I have a text file like this
> 34 RADIO
> 2 RADWIN
> 1 RAGE
> 1 RAIL
> 1 RAU
> 3 RAU2
> 2 RE
> 2 RECEIVERS
> 13 RECEPTION
> 1 RECORDING
> 1 RECTIFIER
> 4 REF
> 3 REFURBISHED
> 4 REPEATER
> 
> I want to sort this by first word(here it is number).
> 
> Output should be like this
> 
> 34 RADIO
> 13 RECEPTION
> 4 REF
> 4 REPEATER
> 3 RAU2
> 3 REFURBISHED
> 2 RADWIN
> 2 RE
> 2 RECEIVERS
> 1 RAGE
> 1 RAIL
> 1 RAU
> 1 RECORDING
> 1 RECTIFIER

cat <file name>|sort -nr
should do

man sort will help as well

- -- 

|_|0|_|                                          |
|_|_|0|         "Heghlu'Meh QaQ jajVam"          |
|0|0|0|         -------- kuLa ---------          |

gpg --keyserver pgp.mit.edu --recv-keys 0xC100B4CA
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJO009cAAoJEOqHloDBALTKKcEIAJV2I5R/kZT0ImIi+tB5tNa2
YCsFbb5cK2YrhAaQBOoHRBGgoi3CD4L+tave5IjeyPqQhu1Op2Y1R2/60RIinPBD
aHYXBsZeopWUlIqGCAvM4rkqqrbKVGyWNY2Gczxf59C/tdsxrUyCWALKZpS881UO
K21E1T4GSL0KQx6dCxAJaKmMCkpgZ5bOvqBN1hGs+v64owZ2hVFICVYTiq3S54Il
Rd1VaVxOOw2vSCQBvb+ECWlHLd0rpD6MLA5vEjQ7nhBDbofmdwMhmOV3JtRqi7Nq
wbp0dJ7co46wuJsMlgLmOm1/HTtMWHTg97ZhuFJMEyIPaWwXYS05sm2zKZdCBVg=
=9PPd
-----END PGP SIGNATURE-----


Reply to: