sed: insert lines from file

This commit is contained in:
Pallav Kumar Shrestha committed 2023-03-17 22:40:20 +01:00
1 parent c1a3ef220f
commit 00cf292c1a
1 file changed
+8
+8
View File
@@ -257,6 +257,14 @@ Insert "Example: " before each line that contains "hello"
```shell script
$ sed '/hello/i Example: ' file.txt
```
Insert lines from file1 before line 5
```shell script
$ sed '5 r file1' file.txt
```
Insert lines from file1 after the line that starts with "hello"
```shell script
$ sed '/^hello/ r file1' file.txt
```