|
From: | Ray Jetton |
Subject: | Sort program |
Date: | Wed, 02 Jan 2002 16:56:07 -0600 |
Copyright (C) 1999 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.
I have a text file named base.txt that has the following structure:
/* Structure for the base file. */
struct datafile{
char sex[1];
/* 0 - 0 */
char Purpose[8];
/* 1 - 8 */
char Construction[8];
/* 9 - 16 */
char Descrip1[8];
/* 17 - 24 */
char Descrip2[8];
/* 25 - 32 */
char Descrip3[8];
/* 33 - 40 */
char file_name[8];
/* 41 - 48 */
char supply_num[16];
/* 49 - 64 */
char describe[61];
/* 65 - 125 */
char our_part_no[17];
/* 126 - 142 */
char price_wout_gold[10];
/* 143 - 152 */
char weight_24[12];
/* 153 - 164 */
char html_no[8];
/* 165 - 172 */
char expansion[2];
/* 173 - 174 */
char year[1];
/* 175 - 175 */
char page_no[3];
/* 176 - 178 */
char crlf[2];
/* 179 - 180 */
/* New length is 180 */
};
The problem occurs in Descrip1, Descrip2, and Descrip3, which are
randomly filled with descriptive information. A portion of the problem
file follows.
This is the first 64 columns of the problem file which contains
12,700+ lines.
FBracelet14K GoldAquamari
330044 330044
FBracelet14K GoldAquamari
330068 330068
FBracelet14K GoldAquamari
330132 330132
FBracelet14K GoldBangle
br249 BR249
FBracelet14K GoldBangle
br250 BR250
FBracelet14K GoldBangle
br251 BR251
FBracelet14K GoldBangle
br252 BR252
FBracelet14K GoldBangle CZ
br056 BR056
FBracelet14K GoldBangle CZ
br058 BR058
FBracelet14K GoldBangle CZ
br059 BR059
FBracelet14K GoldBangle CZ
br061 BR061
FBracelet14K GoldBangle CZ
br062 BR062
FBracelet14K GoldBangle CZ
br064 BR064
FBracelet14K GoldBangle CZ
br065 BR065
FBracelet14K GoldBangle CZ
br5085 BR5085
FBracelet14K GoldBangle
fbr10 FBR10
FBracelet14K GoldBangle
fbr11 FBR11
FBracelet14K GoldBangle
fbr8 FBR8
FBracelet14K GoldBangle
fbr9 FBR9
FBracelet14K Gold
br004 BR004
FBracelet14K Gold
br005 BR005
FBracelet14K Gold
br261 BR261
When sorted, the CZ entries should be grouped together at the bottom of their column. Instead of sorting on the CZ column it seems to be sorting on the next column. I want the sort program to sort across the full line of 180 characters which I cannot seem to get it to do. I want the spaces to be treated exactly like alphabetic characters and not as field indicators.
I have tried such things as "sort base.txt -k1.1 -o temp.txt", and many other command line entries that seemed like they should work, but nothing seems to help. Is this a bug or do I just not know what I am doing?
--
Ray Jetton
The Gold Place
338 Las Brisas
Arlington, Texas 76006-5836
817.652.0402 Local
800.579.6222 Toll Free
817.652.0520 Fax
http://www.goldplace.com
[Prev in Thread] | Current Thread | [Next in Thread] |