The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Can somebody solve this please sreenusola Shell Programming and Scripting 1 08-28-2008 08:50 PM
please help me solve this issue......... Renjesh SUN Solaris 5 05-23-2008 09:28 AM
Help me to solve this issue Renjesh SUN Solaris 2 05-09-2008 09:23 AM
Can AWK solve it ??? emon Shell Programming and Scripting 1 02-23-2005 01:07 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 11-26-2008
karthickrn karthickrn is offline
Registered User
  
 

Join Date: Dec 2007
Posts: 19
Post Can anyone solve this awk issue ?

awk -F^ '{ if (($1 != "X") && ($5 != "3")) || if (($1 != "S") && ($5 != "2")) print $0}' abc> xyz

The above command returns this error

awk: syntax error near line 1
awk: illegal statement near line 1


I am newbie to awk, Any awk intelligence involved in correcting this issue is highly appreciated.

Thanks in advance.
  #2 (permalink)  
Old 11-26-2008
Franklin52 Franklin52 is offline Forum Staff  
Moderator
  
 

Join Date: Feb 2007
Posts: 4,308
Remove the second if in your awk command.

Regards
  #3 (permalink)  
Old 11-26-2008
vguleria vguleria is offline
Registered User
  
 

Join Date: Mar 2008
Location: India(Sarkaghat)
Posts: 28
Suggested usage:

awk -F^ '{ if ( (($1 != "X") && ($5 != "3")) || (($1 != "S") && ($5 != "2")) ) print $0}' abc> xyz


Regards,
Vinod.



Quote:
Originally Posted by karthickrn View Post
awk -F^ '{ if (($1 != "X") && ($5 != "3")) || if (($1 != "S") && ($5 != "2")) print $0}' abc> xyz

The above command returns this error

awk: syntax error near line 1
awk: illegal statement near line 1


I am newbie to awk, Any awk intelligence involved in correcting this issue is highly appreciated.

Thanks in advance.
Closed Thread

Bookmarks

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 02:06 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0