UNIX Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsOperating SystemsUNIX Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old March 14th, 2004, 10:44 PM
melinda melinda is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Posts: 76 melinda User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 56 m
Reputation Power: 5
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.

Reply With Quote
  #2  
Old March 18th, 2004, 01:33 PM
druuna druuna is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Posts: 137 druuna User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 m 37 sec
Reputation Power: 0
The = should be ==.
= is for assigning (a=100, a=$X)
== is for comparison.

Hope this helps.

Reply With Quote
  #3  
Old March 23rd, 2004, 08:37 PM
melinda melinda is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Posts: 76 melinda User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 56 m
Reputation Power: 5
Ok I foud out this is how it works
awk -F, '{if($1="'$cust'" && $2="'$os'") print $1, $2, $3}'

Reply With Quote
Reply

Viewing: Dev Shed ForumsOperating SystemsUNIX Help > awk question


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway