The Cookie Machine - Click here to drag window

DUMMY TEXT - Real text set in assets/js/theCookieMachine.js

If you can read me, I'm broken!

Views: 43,211β€…    Votes:  11β€…    βœ… Solution
Tag : text-processing  
Link: πŸ” See Original Answer on Ask Ubuntu ⧉ πŸ”—

URL: https://askubuntu.com/q/950434
Title: How can I copy the content of a text file and paste it to another starting at a certain line?
ID: /2017/08/27/How-can-I-copy-the-content-of-a-text-file-and-paste-it-to-another-starting-at-a-certain-line_
Created: August 27, 2017    Edited:  June 12, 2020
Upload: April 8, 2024    Layout:  post
TOC: false    Navigation:  false    Copy to clipboard:  false


head and tail solution

Assume the source file is called ~/a and the file to be inserted is called ~/b. We’ll put the merged file into ~/c:

head -n 5 ~/a > ~/c
cat ~/b >> ~/c
tail --lines=+6 ~/a >> ~/c

After verification rename merged file

After verifying that file c is merged correctly from files a and b we’ll rename c to a using:

mv ~/c ~/a
⇧ How to list PIDs (procesees) for one CPU core only? Prevent automatic reboot after Ubuntu Core update on 16.xx  β‡©