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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using a variable in an expression 1

Status
Not open for further replies.

cuttersw

IS-IT--Management
Aug 10, 2006
9
US
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.
 
variable="@domain.com"
$4 ~ variable { ... }

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Could have swore i'd already tried that but obviously not as it works fine! - Thanks very much for the help PH.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top