13

How to insert text using a second file in Linux

view full story
linux-howto

http://www.unix.com – How can i insert text at a particular line number or before/after a search pattern? The text i want to insert is of 8-10 lines including new line characters. I have stored this text in a separate file. I know i can use Code: sed '{/pattern/|/regexp/|n}{i|a|c}<text to be inserted>' file But i want <text to be inserted> in a separate file because there are many special characters which i need to escape and that is very hectic if i have large block of text. I am using Redhat Linux 6.2. Any better way to do it..? (HowTos)