Cut, sort ?

Chat about Linux in general

Cut, sort ?

Postby Arnaudlinux on Fri Sep 07, 2012 4:30 pm

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 !!!
Arnaudlinux
Level 1
Level 1
 
Posts: 2
Joined: Tue Sep 04, 2012 6:38 pm

Linux Mint is funded by ads and donations.
 

Re: Cut, sort ?

Postby zerozero on Fri Sep 07, 2012 4:41 pm

[deleting your other duplicated post, please don't double-post]
zerozero
Level 16
Level 16
 
Posts: 6467
Joined: Tue Jul 07, 2009 2:29 pm

Re: Cut, sort ?

Postby xenopeek on Fri Sep 07, 2012 4:44 pm

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
User avatar
xenopeek
Level 21
Level 21
 
Posts: 14524
Joined: Wed Jul 06, 2011 3:58 am
Location: The Netherlands

Re: Cut, sort ?

Postby Arnaudlinux on Fri Sep 07, 2012 5:03 pm

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 !
Arnaudlinux
Level 1
Level 1
 
Posts: 2
Joined: Tue Sep 04, 2012 6:38 pm


Return to Chat about Linux

Who is online

Users browsing this forum: No registered users and 4 guests