Frage

I have a log-file. Most of the lines in it ends with some sub-string (for example it 0.02). I can filter that lines with pattern 0\.02$. But how I can filter rest lines, other than ending with 0.02?

War es hilfreich?

Lösung

You need a negative lookbehind assertion:

(?<!\b0\.02)$

Andere Tipps

Find end-of-line, then look back to check if your string is not there:

.(?<!0\.02)$

If you're using grep then grep has -v switch just for that:

 egrep -v "(^|[^0-9])0\.02$" my.log
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top