Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

awk syntax question

Status
Not open for further replies.

lambros

Programmer
Oct 10, 2002
42
0
0
US
Hi all,

is the following syntax correct in awk - I wish to test if the line $0 matches the test /invalid credentials/ but does not match the variable /test/?

if($0 ~ /Invalid credentials/ !~ /test/){
print $0
}

Lambros.
 
Depending on what you mean by "match the variable test", this may do what you want.

if($0 ~ /Invalid credentials/ && $0 !~ /test/){
CaKiwi
 
'test' is a variable (I think):

if($0 ~ /Invalid credentials/ && $0 !~ test){
vlad
+---------------------------+
|#include<disclaimer.h> |
+---------------------------+
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top