Insert a line in the middle in multiple files

Suppose you want to insert a line at 10th line of all files in current directory (e.g. all txt files). The following command creates a backup for each file with the extension “.bak” and changes the files inplace.

sed -i'.bak' '10iThis is the inserted line' *.txt