![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| UNIX for Advanced & Expert Users Advanced UNIX and Linux questions go here. Expert-to-Expert. |
|
|
||||
| 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 |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#15
|
|||
|
|||
|
I'll call it a week now - it's 17:37 over here. I'll pick up again on monday.
cheers Guys |
| Forum Sponsor | ||
|
|
|
#16
|
|||
|
|||
|
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
|
|
#17
|
|||
|
|||
|
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.
|
|
#18
|
|||
|
|||
|
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. |
|||
| Google The UNIX and Linux Forums |