How can I use \"sed\" command to get the last n lines of a huge text file (e.g. A.txt) and copy them into a new text file(e.g. B.txt)? I do not want to remove that lines fro
Here's how to use sed to print the last 10 lines of a file:
sed -e :a -e '$q;N;11,$D;ba'
You should probably only use this if you're planning on executing more sed commands on these lines. Otherwise the tail command is designed for this job.