Insert multiple lines into a file after specified pattern using shell script
问题 I want to insert multiple lines into a file using shell script. Let us consider my input file contents are: input.txt: abcd accd cdef line web Now I have to insert four lines after the line 'cdef' in the input.txt file. After inserting my file should change like this: abcd accd cdef line1 line2 line3 line4 line web The above insertion I should do using the shell script. Can any one help me? 回答1: Another sed , sed '/cdef/r add.txt' input.txt input.txt: abcd accd cdef line web add.txt: line1