2

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
don_crissti
  • 79,330
  • 30
  • 216
  • 245
Janet Doe
  • 31
  • 4
  • 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 09 '18 at 22:29

1 Answers1

0
sed '/! comment/ r insertfile' destinationfile
||urty
! comment
||bob
||mary
||david
||gdfgrw
||fdfdf
steeldriver
  • 78,509
  • 12
  • 109
  • 152