Advertisement
Guest User

Untitled

a guest
Mar 20th, 2019
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. $Elements$
  2. 3
  3. 1
  4. 5
  5. 7
  6. $EndElements$
  7.  
  8. 1 65 71
  9. 2 32 87
  10. 3 39 98
  11. 4 41 63
  12.  
  13. $Elements$
  14. 1 65 71
  15. 2 32 87
  16. 3 39 98
  17. 4 41 63
  18. $EndElements$
  19.  
  20. lead='^$Elements$$'
  21. tail='^$EndElements$$'
  22. # f2 is the file where the information
  23. # to replace is kept in
  24. sed -e "/$lead/,/$tail/{ /$lead/{p; r insert_file
  25. > }; /$tail/p; d }" f2
  26.  
  27. echo -e '/$Elements$/+1,/$EndElements$/-1dn.-1r f2nw' | ed -s f1
  28.  
  29. sed -e "
  30. /$lead/,/$tail/!b
  31. //!d
  32. /$lead/r f2
  33. " f1
  34.  
  35. $Elements$
  36. 1 65 71
  37. 2 32 87
  38. 3 39 98
  39. 4 41 63
  40. $EndElements$
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement