|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
awk question
I can match variable $1 and $2 as follow
awk -F, '{if($1 ~ /'$cust'/ && $2 ~ /'$os'/) print $1, $2, $3}' but if I want to do as bellow it is not working awk -F, '{if($1=$cust && $2=$os) print $1, $2, $3}' I want to use if $1 equal to my customer name && $2 equal linux what I need to do Last edited by melinda : March 14th, 2004 at 11:01 PM. |
|
#2
|
|||
|
|||
|
The = should be ==.
= is for assigning (a=100, a=$X) == is for comparison. Hope this helps. |
|
#3
|
|||
|
|||
|
Ok I foud out this is how it works
awk -F, '{if($1="'$cust'" && $2="'$os'") print $1, $2, $3}' |
![]() |
| Viewing: Dev Shed Forums > Operating Systems > UNIX Help > awk question |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|