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 jackmanBrought to you by Warp, a free terminal reimagined to work like a modern app.
line_number
text
file_name
Command
Copy
sed -i '' 'line_numberi\
line_number text' file_name
Tags
Edit in GitHub
Copied