Insert a line at a specific line number

Inserts a line of text into a specific line number of a file using sed. The `-i` flag indicates the file is modified in place.

Authored by: glenn jackman
line_number
text
file_name

Command
Copy
sed -i '' 'line_numberi\ line_number text' file_name
Tags