I want to insert the contents of file1 into file2 after a matching PATTERN. I want to do it only after the first occurrence of the PATTERN.
I would like to know the modification I need to make to the following command for my needs.
sed -i "/PATTERN/r file1" file2
Best Answer
:a
,n
,ba
is just a cycle that printouts the whole file content after the PATTERN till the end. and note, that those 6 lines are just one command, but newline is needed to delimit the next sed command afterr
,:
andb
.additional info from
info sed
: