Cut, sort ?

Chat about Linux in general
Forum rules
Do not post support questions here. Before you post read the forum rules. Topics in this forum are automatically closed 6 months after creation.
Locked
Arnaudlinux

Cut, sort ?

Post 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 !!!
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
zerozero

Re: Cut, sort ?

Post by zerozero »

[deleting your other duplicated post, please don't double-post]
User avatar
xenopeek
Level 25
Level 25
Posts: 29597
Joined: Wed Jul 06, 2011 3:58 am

Re: Cut, sort ?

Post 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
Image
Arnaudlinux

Re: Cut, sort ?

Post 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 !
Locked

Return to “Chat about Linux”