Search code examples
greptail

How to delete tail grep matches?


I have checked out previous posts but could not find anything that worked for me. I have a log file that has been made huge by some recurring error that was a result of changes I made to a script. I want to delete all lines containing this error message.

When I run

sudo tail -1000000 /var/log/kannel/MT.usage.log|grep 'utf-8'

I display from the log file all entries that look like

...[22297] [3] ERROR: Failed to convert string from <utf-8> to <UTF-16BE>, errno was <84>

There are more than 1 million lines. I want to delete all these entries from the log file. How do I do this?


Solution

  • Try doing this :

    sed -i '/ERROR: Failed to convert string from to/d' filename.log