[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index]
[Date Index]
[Thread Index]
[SQR-USERS Info]
[SQRUG Home Page]
Re: Sorting on multiple columns in a flat file
- Subject: Re: Sorting on multiple columns in a flat file
- From: Wayne Ivory <wivory@WSL.COM.AU>
- Date: Mon, 19 Oct 1998 09:03:00 +0800
Ray,
Being on a Unix system the simplest way is probably to use the Unix 'sort' via a call system command. Unfortunately the syntax is one of the most obtuse of all the unix commands, but for your example (if we assume a character such as tilde does not occur in your input file) the syntax would be:
sort -t~ +0.0 -0.5 +0.15 -0.18 infile > outfile
Some advanced versions of unix have a more understandable "-k" option. Also if you have "true" columns (ie some physical separator) you can use that to your advantage. You should really do a "man sort" to get an understanding of how it works.
Wayne Ivory
Information Services
Westralian Sands Limited
>>> "Riepenhoff, Ray" <riepenhoffrm@LMUS.COM> 17/10/98 2:27:43 am >>>
I want to sort a flat file from an SQR. How can I sort on, for example,
columns 1 thru 5, then have a secondary sort on columns 16-18? I
believe I can do a 'CALL SYSTEM...', but I'm not certain of exactly how.
I looked at many of the archives at the SQR-USERS internet site, but
didn't see any doing multiple sorts.
I'm using SQR v3.0.18.1.1, Oracle database, Unix, PeopleSoft, Windows
95...anything else needed?
Thanks in advance.
Raymond M. Riepenhoff Lockheed Martin Utility
Services
Corporate Information Technology 3930 U. S. Route 23 South
Applications Support XT-801, Mail Stop 6001
Phone: (740)289-2331 ext 5842 Piketon, OH 45661
Fax: (740)897-2066 Email:
riepenhoffrm@lmus.com