Bash – How to remove lines from large text file using bash


I got a huge text file (log file) in my CentOS which I would like to remove top part of, probably couple of thousand lines each day. (Or probably just split into two)

I have search this site and found that most using grep, sed to remove the lines but output to another file. Not sure if it is possible that using shell script (bash) that I can update the file in place? instead of:

sed current file > new file
cp new file > current file


Best Answer

sed --in-place $filter $file

Related Question