sed

To insert text “hello world” at line 3 in greeting.txt:

$ sed '3a\

hello world ‘ greeting.txt