[sed] Insert Line After First Pattern Match


Insert a line after first pattern match via sed stream editor.

In the files with names starting with dhp-story under current directory, find the line that starts with :oldurl:, insert the following line after the matched line:

:author: 護法法師

sed -i '/:oldurl:/a :author: 護法法師' dhp-story*

Tested on Ubuntu Linux 15.10, sed 4.2.2-6.1.


References:

[1]
[2][Python] Insert Line With Matched Pattern