awk for-loop
Hi guys,
I am writing a simple bash script looking like this: LOOP1 Code:
#!/bin/bash BUT ! If I change it to the following: LOOP2 Code:
#!/bin/bash Strangely, if I echo $NRCORES or $ENDLOOP in the script I get 8 and 17 respectively, so in my view LOOP1 is exactly the same as LOOP2. However, awk doesn't seem to agree with me. In addition, I know for sure that when awk encounters a non-numeric variable in the print statement, it will take it as a zero and print the whole string. Therefore, I don't see what the problem can be. WHAT IS WRONG WITH IT ? please respond |
Hi,
This works: Code:
#!/bin/bash Hope this helps. |
Quote:
|
Hi,
Which $i are you talking about? The for loop with the i=x;i<=y;i++ part is were i is generated (not $i). This is how awk works. Maybe you should tell us what it is you are trying to accomplish so we can come up with code that suits that. Hope this helps. |
use the -v option of awk to pass in shell variables to awk. Its "preferred" , than messy quoting.
Code:
|
All times are GMT -5. The time now is 06:58 AM. |