Insert content of a file to another file on Linux -


i have 2 files. want insert content of first file(file1) second file (file2) between codes (second file script). example second file should this

upcode... #upcode ends here file1 content downcode ... 

upcode #upcode ends here , downcode should never change.

how can done?

here script (note start tag has unique in file)--

#!/bin/bash  start="what need"  touch file2.tmp  while read line   if [ "$line" = "$start" ]        echo "$line" >> file2.tmp      cat file2 >> file2.tmp   fi   echo "$line" >> file2.tmp done < file1 #mv file2.tmp file1 -- moves (i.e. renames) file2.tmp file1.  

Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -