> awk '$1 == "word"{print}' /var/log/messages

This example assumes that word is the first field and that it consists
only of "word". If the first field is "word1" this won't match.

Fixes for this are 

awk '$1 ~ "word"{print}'

(this matches any occurrance of "word" in the first field)

or:

awk '/^[[:space:]]*word/ {print}'

(this matches any line starting with whitespace followed immediately by
"word")


-- 
Spiro Harvey                  Knossos Networks Ltd
021-295-1923                    www.knossos.net.nz

Attachment: signature.asc
Description: PGP signature

_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos

Reply via email to