How can I insert a set of lines (about 5) into a file at the first place a string is found?
For example:
BestAnimals.txt
dog
If you know (or somehow find out) the line:
sed -n '/cat/=' BestAnimals.txt
You can use sed:
sed -i '2i giraffe' BestAnimals.txt