Re: How to sort ignoring digits? (was: Contacts printing)
- From: Rodolfo Medina <rodolfo.medina@xxxxxxxxx>
- Date: Fri, 09 Nov 2007 12:48:31 +0100
On Thu, Nov 08, 2007 at 03:42:33PM +0100, Rodolfo Medina wrote:
In the documentation of `sort' I couldn't find the possibility of
ignoring digits. I have a document that contains names and phone
numbers and I wish to sort it by names. The `-k' option doesn't seem
to help because names and numbers are not in definite fields.
[...]
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!
Andrew Sackville-West <andrew@xxxxxxxxxxxxxxxxxxxx> writes:
well the semicolons are easy:
sed -i -e 's/^.*\; //' filename
this (untested) should match any string at the beginning of a line
endind with semi-colon/space and replace it with nothing. It will do
it in place on the existing filename, so make a copy first, so you can
confirm its behavior.
You need, in my opinion, to get this data into a more uniform format
to do much with it. And you need to decide a couple of things. Do you
want the numbers first or second. Do you want to sort on The whole
name? the last name? how do you want to handle things like ABC Travel?
Also, are these lines representative of all the data? can you rely on
the lines looking only like this and not having any other format?
Thanks for your reply.
All I want is to sort lines by letters ignoring digits. It's amazing to me that
such a potent tool as `sort' can't do that! Maybe some other tool?
Thanks
Rodolfo
--
To UNSUBSCRIBE, email to debian-user-REQUEST@xxxxxxxxxxxxxxxx
with a subject of "unsubscribe". Trouble? Contact listmaster@xxxxxxxxxxxxxxxx
- Follow-Ups:
- Re: How to sort ignoring digits? (was: Contacts printing)
- From: Andrew Sackville-West
- Re: How to sort ignoring digits? (was: Contacts printing)
- From: Russell L. Harris
- Re: How to sort ignoring digits? (was: Contacts printing)
- References:
- Re: Contacts printing
- From: Rodolfo Medina
- Re: Contacts printing
- From: Kevin Mark
- How to sort ignoring digits? (was: Contacts printing)
- From: Rodolfo Medina
- Re: How to sort ignoring digits? (was: Contacts printing)
- From: Russell L. Harris
- Re: How to sort ignoring digits? (was: Contacts printing)
- From: Douglas A. Tutty
- Re: How to sort ignoring digits? (was: Contacts printing)
- From: Rodolfo Medina
- Re: How to sort ignoring digits? (was: Contacts printing)
- From: Andrew Sackville-West
- Re: Contacts printing
- Prev by Date: Is LVM pvcreate command distructive?
- Next by Date: [HELP!] Network Disappeared ON Dell D630 Laptop
- Previous by thread: Re: How to sort ignoring digits? (was: Contacts printing)
- Next by thread: Re: How to sort ignoring digits? (was: Contacts printing)
- Index(es):
Relevant Pages
|