I tried doing it with cat and then after I type the second file I added | head -$line | tail -1 but it doesn’t work because it performs cat first.
Any ideas? I need to do it with cat or something else.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I’d probably use
sedfor this job:If you’re looking to overwrite
file1and you have GNUsed, add the-ioption. Otherwise, write to a temporary file and then copy/move the temporary file over the original, cleaning up as necessary (that’s thetrapstuff below). Note: copying the temporary over the file preserves links; moving does not (but is swifter, especially if the file is big).