1

Using a bash script, I'm having difficulty trying place one file into another based on a certain location.

||bob
||mary
||david

destination:

||urty
! comment
||gdfgrw
||fdfdf

So basically drop all of the contents of one file into (below the ! comment) header:

So the destination should look like this:

||urty
! comment
||bob
||mary
||david
||gdfgrw
||fdfdf

marked as duplicate by don_crissti, Jeff Schaller, G-Man, Sundeep, X Tian Mar 10 '18 at 12:17

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • What if there are multiple lines like ! comment ? Do you want to insert only after the 1st one or after all of them ? – don_crissti Mar 9 '18 at 22:29
0
sed '/! comment/ r insertfile' destinationfile
||urty
! comment
||bob
||mary
||david
||gdfgrw
||fdfdf

Not the answer you're looking for? Browse other questions tagged or ask your own question.