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

Re: How to sort ignoring digits? (was: Contacts printing)



* Rodolfo Medina <rodolfo.medina@gmail.com> [071109 05:56]:
> On Thu, Nov 08, 2007 at 03:42:33PM +0100, Rodolfo Medina wrote:
> 
> >>
> >> Here are a few lines from the file:
> >> 
> >> 3938269241 320192481 Stan Laurel
> >> 3939424701 0815605311 Oliver Hardy
> >> 800151611 800822051 Harpo Marx
> >> ABC Travel 0111111111 33811111111
> >> Acade;Paolo;;; 335111111 Paolo Acade
> >> Acade;Pasquale;;; 335122211 Pasquale Acade
> >> 
> >> I wish it to be sorted by letters (i.e. by names) - and also eliminate those
> >> ugly semicolons!

One approach:

1. Create a modified duplicate of the file such that each record in
the duplicate includes a pointer to the corresponding record of the
original file.  This modified duplicate is the "key".

2.  Remove from the key all numeric strings, and all
strings containing semicolons.  

3.  Perform an alphabetic sort on the key.

4.  Use the sorted key to print the records
of the original file, or to copy them to a new file, which then can be
edited to remove semicolons, etc.

RLH



Reply to: