sed - Add few line with in the middle of a file -


i want add few in file. possible use sed?

original file test1 test2 test3 

expected output after adding new line

test1  # testing123 #  test3 

if don't mind using "while/read" instead of "sed", 1 solution:

[~]$ cat original.txt test1 test2 test3  [~]$ cat new_content.txt  # testing123 # 

then, process both files following script:

script.sh

#!/bin/bash  while ifs= read -r line         if [[ $line =~ ^test2.*$ ]]                         cat new_content.txt         else                 echo "$line"         fi done < original.txt 

Comments

Popular posts from this blog

css - SVG using textPath a symbol not rendering in Firefox -

Java 8 + Maven Javadoc plugin: Error fetching URL -

datatable - Matlab struct computations -