home *** CD-ROM | disk | FTP | other *** search
-
- HOW TO USE SORT, vers. 1.5
-
- calling syntax: SORT15 infile [outfile] [@<skip string>]
-
- The characters to skip begin immediately after the "at" symbol, "@".
- SORT expects that the file to be sorted must be terminated by with a
- CR/LF combination for every line. If a "skip string" is used, the
- characters which are to be skipped before performing the sort MUST be
- present in every line.
-
-
- NOTES:
-
- 1. Characters in skip string need not be adjacent.
- 2. If a tab character (^I) is to be included as a skip character, an
- output file MUST be specified, or use " . " as output name.
- 3. Wildcard is "?". Ex: SORT file @/?? sorts on 3d char after the
- slash. Unfortunately, SORT15 cannot sort on question marks. If a
- question mark is to be included in the skip string, use SORT
- version 14.
- 4. The entire file to be sorted must fit into memory. If the file is
- larger than available memory, the program will abort.
-
- Please note that in each of the examples which follow, I have
- included an output file. You will find this a good practice, as your
- sort may not always turn out as you expect. However, it is not
- necessary to specify an output filename. If you omit the output
- filename, SORT will overwrite the original file.
-
-
- SAMPLES OF USE
-
-
- Data file looks like this:
-
- Tom Jones,123 Main St.,Chicago,IL,60640
- Bob Jones,432 Prairie,Detroit, MI,99870
- Joe Smith,Box 15,Palmyra,NY,11265
- John Doe,The Morgue,New York,NY,11234
- The President,,Washington,DC,20202
- etc. . . .
-
-
- Example 1 -- ZIP CODE ORDER
-
- You want to rearrange these names into zip code order, then use
- MailMerge to create mailing labels for printing. Since commas are the
- "delimiter" used in the datafile above, the zip code appears after the
- last comma (i.e., the 4th comma) in every case above. This is a case
- when the characters used in the skip string need not be adjacent to
- each other.
-
- To sort these names in zip code order, simply type
-
- SORT datafile.dat ziporder.dat @,,,,<return>
-
- Be sure not to include even a single space after the 4th comma, as
- SORT will include the space as a character in its skip string. Since
- there are no spaces after the 4th comma on each line, no sort will be
- performed.
-
- If you have EMBEDDED commas in any field, the lines containing
- these will be out of order. Names added in DataStar, for example, may
- contain embedded commas. They look like this:
-
- John Taylor,"100 Park Ave., Apt. 3",Wooster,OH,47098
- "Mike Michaels, Esq.","Heritage Plaza, 111 Ash Lane",Chicago...
-
- DataStar handles embedded commas by putting quotation marks around
- them. This way, they are not confused for field delimiters.
- Unfortunately, they cannot be handled easily by SORT15. If I had a
- file which needed to be sorted, however, I would do the sort and ignore
- the embedded commas. Then, I would open up VDE and use ^QF to locate
- any lines with quotation marks. Then I'd block the entire line (^KB,
- ^KK) and move it to its proper place. A slower process, but necessary.
-
-
- Example 2 -- FIRST NAME ORDER
-
- You can sort the same datafile into alphabetical order, according
- to first name, simply by typing
-
- SORT filename.typ outfile.typ<return>
-
- All the names will be sorted according to first name and last
- name. Remember that according to ASCII convention, all capital letters
- come before any small letters. So you may come up with a sequence like
- this, which is strictly permissible in ASCII alphabetizing standards:
- James Underwood
- James Vanderbilt
- James Williams
- James van Gorden
-
-
- Example 3 -- LAST NAME ORDER
-
- The same datafile, now sorted alphabetically by first name, can be
- sorted alphabetically by LAST name, even though there is not a comma
- between the first and last names. There IS a character which
- distinguishes when the last name begins: the space. The datafile can
- be sorted by last name by typing
-
- SORT datafile outfile @<space><return>
-
- Note that you do not literally type 8 characters - "<space>" - but
- instead simply tap the spacebar once after typing "@", and then hit the
- return key.
-
- A potential problem may arise if you have included titles in your
- datafile (e.g., Dr., Mrs., Prof., Rev., etc.). Since a space normally
- follows the title and the first name, any lines with titles will be out
- of order.
-
- You could escape this problem if your datafile was written like this:
-
- title,firstname lastname,address,city,st
- Mr.,John Adams,PO Box 450,Grand Junction,CO
- Prof.,Edward Hills,Harvard Univ.,Cambridge,MA
- ,Molly McGuire,102 Fairhaven Dr.,Altadena,CA
- ,Joe Nobody,PO Box 1402,Flushing,NY
-
- In such cases, to sort on last name, invoke the program like this:
-
- SORT infile outfile @,<space><return>
-
-
- Example 4 -- USING THE WILDCARD
-
- The wildcard symbol for the SORT string is the question mark.
- Thus, suppose you have a file where the first line begins with
- filenames which lack a period between the filename and filetype, like
- this:
-
- SETPRINTASM
- VINST263CZM
- VDE263 COM
- WSMSGS OVR
- ZCPR HLP
-
- If you want to the file sorted based on filetype, disregarding the
- first 8 characters of the filename, you would invoke SORT as follows:
-
- SORT infile outfile @????????<return>
-
- Before going on to the next example, I'll just remind you that you
- can use a TAB character (^I) in the skip string.
-
- Suppose you have a database program which accepts input for
- telephone numbers, but doesn't add a hyphen between the area code and
- the number. For some reason, you want the list sorted according to
- phone number, regardless of area code. In this case, your skip string
- would consist of the necessary delimiters, and then the question marks.
-
- FILE: firstname,lastname,address,city,state,zip,phone
- John,Jones,R.R. 4,Hampton,IA,99046,3097974312
- Brad,Tacks,100 E. Ave.,Wiley,OK,69987,9873421048
-
- The sort syntax would be invoked like this:
-
- SORT infile outfile @,,,,,,???<return>
-
- In the example above, Brad Tacks, phone 342-1048, would be listed
- before John Jones, 797-4312.
-
- Hope this gives you some good ideas on how to use SORT15!
-
- --- suggestions by Eric Pement 02/14/88