The UNIX and Linux Forums  

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
manipulate a passed in parameter rudoraj Shell Programming and Scripting 2 06-11-2007 02:04 PM
Perl script variable passed to Oracle query rahulrathod Shell Programming and Scripting 1 05-30-2007 09:57 AM
Assigning a Variable all the Parameters passed samit_9999 UNIX for Dummies Questions & Answers 2 12-04-2006 05:21 PM
variable passed to awk whatisthis UNIX for Dummies Questions & Answers 3 09-15-2004 02:41 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 09-15-2004
whatisthis's Avatar
whatisthis whatisthis is offline
Registered User
  
 

Join Date: Aug 2004
Posts: 175
Question variable passed to awk

Anybody know what's wrong with this syntax?

awk -v job="$job" 'BEGIN { FS="|"}
{print $1,$2," ",$4," ",$3\n,$5,"\n"}' list


It's keeping give me this message:

awk: syntax error near line 1
awk: bailing out near line 1


It seems awk has problem with my BEGIN command.

Any help is appreciated!
  #2 (permalink)  
Old 09-15-2004
RTM's Avatar
RTM RTM is offline Forum Advisor  
Hog Hunter
  
 

Join Date: Apr 2002
Location: On my motorcycle
Posts: 3,039
With just a quick look, you don't have an END statement - unless you didn't post the whole thing. Also make sure you are using the correct awk - at least on Solaris (2.6) /usr/bin/awk and /usr/xpg4/bin/awk are different - no -v option on /usr/bin/awk.

Last edited by RTM; 09-15-2004 at 01:05 PM..
  #3 (permalink)  
Old 09-15-2004
whatisthis's Avatar
whatisthis whatisthis is offline
Registered User
  
 

Join Date: Aug 2004
Posts: 175
Question END statement

I don't think I have to put END statement ???
  #4 (permalink)  
Old 09-15-2004
RTM's Avatar
RTM RTM is offline Forum Advisor  
Hog Hunter
  
 

Join Date: Apr 2002
Location: On my motorcycle
Posts: 3,039
Like I stated - just a quick look. And it seems to work on one version of awk (even without the END statement) but not the one normally in the PATH (see my other post - it was updated). What's your OS and version?
  #5 (permalink)  
Old 09-15-2004
whatisthis's Avatar
whatisthis whatisthis is offline
Registered User
  
 

Join Date: Aug 2004
Posts: 175
Version?

How do I know?
  #6 (permalink)  
Old 09-15-2004
RTM's Avatar
RTM RTM is offline Forum Advisor  
Hog Hunter
  
 

Join Date: Apr 2002
Location: On my motorcycle
Posts: 3,039
The command uname -a should give you the output to find the version and OS.
  #7 (permalink)  
Old 09-15-2004
whatisthis's Avatar
whatisthis whatisthis is offline
Registered User
  
 

Join Date: Aug 2004
Posts: 175
Question Version?

Here it is:
I guess it's SonOS and version 5.7?


SunOS milford2 5.7 Generic_106541-19 sun4u sparc SUNW,Ultra-1
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 12:55 AM.


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