Bash Insert Line Into File At Line Number, If you're looking to overwrite file1 and you have GNU sed, add the -i option.