1. The $0 in expression part of awk invocation such as in
pinczakko@opunaga $ find . -type f | awk '$0 !~ /\<svn\>/ {print}'
doesn't represent any of the field in a record (a line) in awk terminology. $0 represents the whole record (the whole line). Therefore, if you want to match an expression to the entire line, $0 is the way to do that.
2. To match the whole word in awk, use the escaped angle brackets. Escaped angle bracket in awk is \<\> because backslash is the escape character in an awk expression.
pinczakko@opunaga $ find . -type f | awk '$0 !~ /\<svn\>/ {print}'
The invocation above asks awk to print any lines which don't have the word svn in it.
Post a Comment
No comments:
Post a Comment