Skip to main content
Fix markup syntax highligting issues
Source Link
Kusalananda
  • 355.8k
  • 42
  • 735
  • 1.1k

I'm using the ubuntu terminal, I need to move a specific line in a file ( 11th position ) to the first line and then transfer the final result into a new file. The original file contains hundreds of lines.
So far I tried to use the sed command tool, but I'm not achieving what I want. This is what I got so far :

[mission 09] $ sed -n -e '1p' -e '11p' bonjour > bonjour2
[mission 09] $ sed -n -e '1p' -e '11p' bonjour > bonjour2

But it only displays the first and 11th line into the new file. But I want the new file to have the revised position wanted with the rest of the original lines.

Input :

English: Hello 
Turkish: Marhaba 
Italian: Ciao 
German: Hallo 
Spanish: Hola 
Latin: Salve 
Greek: chai-ray 
Welsh: Helo 
Finnish: Hei 
Breton: Demat 
French: Bonjour 
English: Hello 
Turkish: Marhaba 
Italian: Ciao 
German: Hallo 
Spanish: Hola 
Latin: Salve 
Greek: chai-ray 
Welsh: Helo 
Finnish: Hei 
Breton: Demat 
French: Bonjour 

Desired output

French: Bonjour 
English: Hello 
Turkish: Marhaba 
Italian: Ciao 
German: Hallo 
Spanish: Hola 
Latin: Salve 
Greek: chai-ray 
Welsh: Helo 
Finnish: Hei 
Breton: Demat 
French: Bonjour 
English: Hello 
Turkish: Marhaba 
Italian: Ciao 
German: Hallo 
Spanish: Hola 
Latin: Salve 
Greek: chai-ray 
Welsh: Helo 
Finnish: Hei 
Breton: Demat 

Any suggestion ?

I'm using the ubuntu terminal, I need to move a specific line in a file ( 11th position ) to the first line and then transfer the final result into a new file. The original file contains hundreds of lines.
So far I tried to use the sed command tool, but I'm not achieving what I want. This is what I got so far :

[mission 09] $ sed -n -e '1p' -e '11p' bonjour > bonjour2

But it only displays the first and 11th line into the new file. But I want the new file to have the revised position wanted with the rest of the original lines.

Input :

English: Hello 
Turkish: Marhaba 
Italian: Ciao 
German: Hallo 
Spanish: Hola 
Latin: Salve 
Greek: chai-ray 
Welsh: Helo 
Finnish: Hei 
Breton: Demat 
French: Bonjour 

Desired output

French: Bonjour 
English: Hello 
Turkish: Marhaba 
Italian: Ciao 
German: Hallo 
Spanish: Hola 
Latin: Salve 
Greek: chai-ray 
Welsh: Helo 
Finnish: Hei 
Breton: Demat 

Any suggestion ?

I'm using the ubuntu terminal, I need to move a specific line in a file ( 11th position ) to the first line and then transfer the final result into a new file. The original file contains hundreds of lines.
So far I tried to use the sed command tool, but I'm not achieving what I want. This is what I got so far :

[mission 09] $ sed -n -e '1p' -e '11p' bonjour > bonjour2

But it only displays the first and 11th line into the new file. But I want the new file to have the revised position wanted with the rest of the original lines.

Input :

English: Hello 
Turkish: Marhaba 
Italian: Ciao 
German: Hallo 
Spanish: Hola 
Latin: Salve 
Greek: chai-ray 
Welsh: Helo 
Finnish: Hei 
Breton: Demat 
French: Bonjour 

Desired output

French: Bonjour 
English: Hello 
Turkish: Marhaba 
Italian: Ciao 
German: Hallo 
Spanish: Hola 
Latin: Salve 
Greek: chai-ray 
Welsh: Helo 
Finnish: Hei 
Breton: Demat 

Any suggestion ?

Became Hot Network Question
added 491 characters in body
Source Link
ForzaTekk
  • 115
  • 1
  • 8

I'm using the ubuntu terminal, I need to move a specific line in a file ( 11th position ) to the first line and then transfer the final result into a new file. The original file contains hundreds of lines.
So far I tried to use the sed command tool, but I'm not achieving what I want. This is what I got so far :

[mission 09] $ sed -n -e '1p' -e '11p' bonjour > bonjour2

But it only displays the first and 11th line into the new file. But I want the new file to have the revised position wanted with the rest of the original lines.

Input :

English: Hello 
Turkish: Marhaba 
Italian: Ciao 
German: Hallo 
Spanish: Hola 
Latin: Salve 
Greek: chai-ray 
Welsh: Helo 
Finnish: Hei 
Breton: Demat 
French: Bonjour 

Desired output

French: Bonjour 
English: Hello 
Turkish: Marhaba 
Italian: Ciao 
German: Hallo 
Spanish: Hola 
Latin: Salve 
Greek: chai-ray 
Welsh: Helo 
Finnish: Hei 
Breton: Demat 

Any suggestion ?

I'm using the ubuntu terminal, I need to move a specific line in a file ( 11th position ) to the first line and then transfer the final result into a new file. The original file contains hundreds of lines.
So far I tried to use the sed command tool, but I'm not achieving what I want. This is what I got so far :

[mission 09] $ sed -n -e '1p' -e '11p' bonjour > bonjour2

But it only displays the first and 11th line into the new file. But I want the new file to have the revised position wanted with the rest of the original lines.

Any suggestion ?

I'm using the ubuntu terminal, I need to move a specific line in a file ( 11th position ) to the first line and then transfer the final result into a new file. The original file contains hundreds of lines.
So far I tried to use the sed command tool, but I'm not achieving what I want. This is what I got so far :

[mission 09] $ sed -n -e '1p' -e '11p' bonjour > bonjour2

But it only displays the first and 11th line into the new file. But I want the new file to have the revised position wanted with the rest of the original lines.

Input :

English: Hello 
Turkish: Marhaba 
Italian: Ciao 
German: Hallo 
Spanish: Hola 
Latin: Salve 
Greek: chai-ray 
Welsh: Helo 
Finnish: Hei 
Breton: Demat 
French: Bonjour 

Desired output

French: Bonjour 
English: Hello 
Turkish: Marhaba 
Italian: Ciao 
German: Hallo 
Spanish: Hola 
Latin: Salve 
Greek: chai-ray 
Welsh: Helo 
Finnish: Hei 
Breton: Demat 

Any suggestion ?

I'm using the ubuntu terminal, I need to move a specific line in a file ( 11th position ) to the first line and then transfer the final result into a new file. The original file contains hundreds of lines.
So far I tried to use the sed command tool, but I'm not achieving what I want. This is what I got so far : enter image description here

[mission 09] $ sed -n -e '1p' -e '11p' bonjour > bonjour2

But it only displays the first and 11th line into the new file. But I want the new file to have the revised position wanted with the rest of the original lines.

Any suggestion ?

I'm using the ubuntu terminal, I need to move a specific line in a file ( 11th position ) to the first line and then transfer the final result into a new file. The original file contains hundreds of lines.
So far I tried to use the sed command tool, but I'm not achieving what I want. This is what I got so far : enter image description here

But it only displays the first and 11th line into the new file. But I want the new file to have the revised position wanted with the rest of the original lines.

Any suggestion ?

I'm using the ubuntu terminal, I need to move a specific line in a file ( 11th position ) to the first line and then transfer the final result into a new file. The original file contains hundreds of lines.
So far I tried to use the sed command tool, but I'm not achieving what I want. This is what I got so far :

[mission 09] $ sed -n -e '1p' -e '11p' bonjour > bonjour2

But it only displays the first and 11th line into the new file. But I want the new file to have the revised position wanted with the rest of the original lines.

Any suggestion ?

Source Link
ForzaTekk
  • 115
  • 1
  • 8
Loading