[gridengine users] reading arguments using awk with escaped variables

Rayson Ho rayson at scalablelogic.com
Tue Apr 17 05:20:10 UTC 2012


What shell are you using??

Rayson


On Tue, Apr 17, 2012 at 1:15 AM, Sara Rolfe <smrolfe at u.washington.edu> wrote:
> Hi Rayson,
>
> Thanks for your reply.  I have tried using -v to pass variables to awk, but
> it is not working correctly.  I think it's because my script requires all
> variables to be escaped and I don't know how to pass the escape symbol
> correctly.
>
> line2=$(awk -v "task_id=$SGE_TASK_ID" 'NR==task_id' "/myPath/fileList.txt" )
> echo \$line2
>
> has a blank output, but so does
>
> line2=$(awk -v "task_id=\$SGE_TASK_ID" 'NR==task_id' "/myPath/fileList.txt"
> )
> echo \$line2
>
> Can you give me any insight into passing the escape sign or why I am needing
> to escape all the variables in my script?
>
> Thanks,
> Sara
>
>
> On Apr 16, 2012, at 9:13 PM, Rayson Ho wrote:
>
> line2=$(awk -v "task_id=$SGE_TASK_ID" 'NR==task_id' "/tmp/fileList.txt" )
>
>




More information about the users mailing list