sed insert multiple lines after match 1

sed insert multiple lines after match

sed '/cdef/r add.txt' input.txt

Here is what the above code is Doing:
1. The sed command is used to edit the input.txt file.
2. The ‘/cdef/’ is a regular expression that matches the line containing the string “cdef”.
3. The ‘r add.txt’ tells sed to read the add.txt file and append the contents of the file to the line matching the regular expression.
4. The output of the sed command is then redirected to the output.txt file.

Similar Posts