I use the grep file content command and am doing something.
However, the file size grows continuously every second. (will be more than 500 MB)
Due to a performance problem, I want to grep the contents of the file in the last N lines, and not the contents of the entire file.
if grep -q "SOMETHING" "/home/andy/log/1.log"; then
ps -ef | grep "127.0.0.1:50000" | awk '{print $2}' | xargs kill; cat /dev/null > /home/andy/log/1.log
fi
How can I change the contents of a script to a grep file in the last N lines?
Thank!
source
share