Insert text on a particular line number
SED Tricks
Ever needed to create a script which edits a file and places a string on a particular line (iptables etc...), well I came across this sed command which would do just that:
sed '[line number]i\ [my text here]' [filename] > [output filename]
You can even insert text from a file
sed '[line number]r [location of file]' [filename] > [output filename]