Name: bvijays Date: January 4, 2008 at 06:29:17 Pacific Subject: sorting recoreds in a file OS: hp-unix CPU/Ram: p4,5GB Model/Manufacturer: intel
Comment:
Hi, i neeed to sort a file which has lines like 310494550615007O ptt 310494550615008P ptt 310494550615007P ptt 310494550615008Q ptt 310494550615007P ptt 310494550615007Q ptt 310494550615008O ptt
the need to sort from 1.1 to 1.15 and then after that sort the with the char(16i.e., O|P|Q)but in reverse alphabetic order...the o/p should be like,
310494550615007Q ptt 310494550615007P ptt 310494550615007P ptt 310494550615007O ptt 310494550615008Q ptt 310494550615008P ptt 310494550615008O ptt
can anybody suggest how to do that... can i use sort with loops ...
how to sort among a set of lines in the same file? is there any such option
Gosh, I was thinking that the reverse flag could be specified on a key by key basis.
Until you find something better, following is an awk solution that inputs a sorted file, and it just reverses each group of lines. It stores a group into array slots 1 thru n, then pulls them out of the array in reverse order.
The information on Computing.Net is the opinions of its users. Such
opinions may not be accurate and they are to be used at your own risk.
Computing.Net cannot verify the validity of the statements made on this site. Computing.Net and Computing.Net, LLC hereby disclaim all responsibility and liability for the content of Computing.Net and its accuracy.
PLEASE READ THE FULL DISCLAIMER AND LEGAL TERMS BY CLICKING HERE