On Mon, Jan 05, 2009, Joseph L. Casale wrote:
I need to review a logfile with Sed and cut out all the lines that start with a certain word, problem is this word begins after some amount of whitespace and unless I search for whitespace at the beginning followed by "word" I may encounter "word" somewhere legitimately hence why I don't just search for "word" only...
Anyone know how to make sed accomplish this?
There's always more than one way to do something like this:
sed -n '/^[ \t]*word\s/p' /var/log/messages
pcregrep '^\s*word\b' /var/log/messages
awk '$1 == "word"{print}' /var/log/messages
Bill