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

Java 8 + Maven Javadoc plugin: Error fetching URL -

android - How to delete or change the searchview icon inside the SearchView actionBar? -

c++ - Msgpack packing bools bug -