Page 1 of 1

Cut, sort ?

Posted: Fri Sep 07, 2012 4:30 pm
by Arnaudlinux
Hi budies!
Really need some help (and sorry for my English, i'm come frome France),
I'm on ubuntu, bash.
I've got a file with a lot of names delimited with a ";" written like this:

Francois de france; Julien d'amerique; Emilie de Suede; gustave de Picardie;

It's very difficult to read it, cause i have hundreds of them.
I'm trying to sort them like this:

Francois de France;
Julien d'Amerique;
(...)
Gustave de Picardie;

So i tried to use the ";" as a delimiter and reading the arguments:

cut -d ";" -f 1-100 file.txt

It only give me my first style list in the terminal....I'm completly blocked...
Is there here a Linux Champion that can help me..?

Thanks all !!!

Re: Cut, sort ?

Posted: Fri Sep 07, 2012 4:41 pm
by zerozero
[deleting your other duplicated post, please don't double-post]

Re: Cut, sort ?

Posted: Fri Sep 07, 2012 4:44 pm
by xenopeek
And as you are on Ubuntu, moving it here. Though that doesn't matter for the solution :) Try this:

Code: Select all

sed 's/;[^\n]/;\n/g' file.txt

Re: Cut, sort ?

Posted: Fri Sep 07, 2012 5:03 pm
by Arnaudlinux
Vince,
Your a f*ckin genius...!
I was completly blocked! Thanks a lot ! It works perfectly.

Zerozero,
Sorry for the doublon...i take care of this immediatly.

Thanks budies !