Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm using the less to view log files. This is quite good, but I want to filter out some lines from output. E.g. I don't want to see lines containing "DEBUG" or I want see lines which contain only "[pool-9-thread-4]".

Is there easy way to do it? Is there any more advanced tool to work with log files?

I know solution as grep 'pool-9-thread-4' my.log | less, but it is not good enough - I cannot change filtering criteria and it works slow for large files.

share|improve this question

1 Answer 1

A list of characters enclosed by [ and ] is called bracket expression.
For example, the regular expression [0123456789] matches any single digit.
You should escape [] to get literal value:

$ grep '\[pool-9-thread-4\]' my.log | less
share|improve this answer
    
Oh, yes, you are right about the brakets, just a typo, but it is not related to my question. –  kan Mar 2 '12 at 14:26

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.