I am trying to replace lines from one file (file1) with the same number of lines and in same positions from another file(file2). I found
sed -n 1,5p file2
would extract the first five lines from file2.
How can i use these lines and replace the first five lines in file1?
Best Answer
Bit of a cheat, (not pure
sed
), usingsponge
: