I eventually figured out the missing comma from the split function, but what i didn't realize was "in" worked on the key rather than the value.
Once i got past the missing comma I came up with this earlier and it worked too..
BEGIN {...
What is the simplest way to determine if an element in an array contains a particular value?
I have tried the following without success (Always returns "No!"):
split("SMTP,smtp,X400,x400,X500,x500,MS,ms,RFAX,rfax,CCMAIL,ccmail",ValidTypes)
variable = "X400"
if (variable in ValidTypes) {...
...I have managed to improve the above to this:
mbname=$3
if (mbname ~ /^\"/) {
split($3,xxx,"\"")
mbname=xxx[2]
}
Is that as efficent as it gets or am i still missing a simpler solution?
Can anyone suggest a simple way to only return data that exists between quotes within a field.
EG of data set:
Mailbox}@{JohnD}@{John Doe}@{john.doe@domain.com%jd@domain.com%jd@dom2.com}@{y
Mailbox}@{MaryS}@{“Smith, Mary”}@{smithm@domain.com}@{y
Mailbox}@{BudH}@{Bud...
Does anyone know if there is a graphical interface available for developing / debugging AWK programs?
The sort of thing I am looking for will allow you to ‘single-step’ through AWK scripts, add ‘watches’ for variables, etc.
Other features like syntax checking or even an included command...
Nooby question:
I am trying to use a variable in a 'match' expression but am having no luck. Can anyone advise how i should be doing this.
This works:
$4 ~ /@domain.com/ { print NR "\t" # $0 }
But this does not:
variable="@domain.com"
$4 ~ /$variable/ { print NR "\t" # $0 }
Shaun.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.