The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users
Google UNIX.COM


UNIX for Advanced & Expert Users Advanced UNIX and Linux questions go here. Expert-to-Expert.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Weird Issue with crontab. Cameron HP-UX 3 04-21-2008 08:36 PM
a weird issue with "while" block sleepy_11 Shell Programming and Scripting 7 08-06-2007 08:33 PM
weird domain issue. thirddegreekris UNIX for Advanced & Expert Users 2 05-03-2007 09:42 PM
HP-UX weird FTP ? IngmarMeins HP-UX 10 11-29-2005 05:22 PM
Weird SSH issue AKM UNIX for Advanced & Expert Users 6 11-08-2004 11:13 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #15  
Old 04-11-2008
Registered User
 

Join Date: Aug 2005
Posts: 67
I'll call it a week now - it's 17:37 over here. I'll pick up again on monday.

cheers Guys
Reply With Quote
Forum Sponsor
  #16  
Old 04-11-2008
Registered User
 

Join Date: Apr 2008
Posts: 1
The syntax looks correct. By the error message you are getting and the fact that you said this was in a script (not just on the command line) I suspect that there is a spurious, non-printable character in your script that is hosing up the scanning of the line properly and causing it to think that

Try this:
a. you can often find these non-printable chars by using "od -c filename | less"
b. re-type in the command on a new line and delete the old line altogether

Here is an example of how I reproduced your error. Look closely at the output of 'od -c' where there is actually a bad char (002 == CNTL-B) that your editor may not show you, but truly throws an error for nawk:

Code:
$ cat badnawk
#!/bin/sh
nawk -F":" -v red=2 '{print $red}' $0
$
$ sh badnawk
nawk: can't open file {print $red}
 source line number 1
$
$
$ od -c badnawk
0000000   #   !   /   b   i   n   /   s   h  \n   n   a   w   k       -
0000020   F   "   :   "       -   v 002       r   e   d   =   2       '
0000040   {   p   r   i   n   t       $   r   e   d   }   '       $   0
0000060  \n
0000061
Reply With Quote
  #17  
Old 04-14-2008
Registered User
 

Join Date: Aug 2005
Posts: 67
I checked. There are no hidden characters. For double measure, I have re-typed that line of code (not copied and pasted). Still the same error.
Reply With Quote
  #18  
Old 04-14-2008
Registered User
 

Join Date: Aug 2005
Posts: 67
Finally resolved.

nawk -F"," -v red="$random_variable" '{print $red}' $w_dir/$file_name > $w_dir/${column_name}

The double-quotes around the variable did it.
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 09:35 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0