[CentOS] Log File Reviewing

Paul Heinlein heinlein at madboa.com
Mon Jan 5 20:16:24 UTC 2009


On Mon, 5 Jan 2009, Joseph L. Casale wrote:

>> The regex you want is "^[[:space:]]*word"
>
> Wow, thanks everyone for the help! How does one modify this to also 
> knock out lines that *must* have whitespace followed by a number 
> [0-9]? I can do it using "^[[:space:]]*[0-9]" but it also takes out 
> lines w/o whitespace that begin with numbers?

Probably something like "^[[:space:]]\+[0-9]"

-- though that assumes you're using gawk (since the \+ modifier is 
GNU-specific).

For non-GNU awks, "^[[:space:]][[:space:]]*[0-9]"

> I have to buy a book on RegEx's and Sed :)

Good idea!

-- 
Paul Heinlein <> heinlein at madboa.com <> http://www.madboa.com/


More information about the CentOS mailing list