comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » TRICKY TASK USING AWK
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: TRICKY TASK USING AWK [message #92776 is a reply to message #92774] Fri, 26 February 2016 07:09 Go to previous messageGo to previous message
Mats Löfdahl is currently offline  Mats Löfdahl
Messages: 263
Registered: January 2012
Senior Member
Den fredag 26 februari 2016 kl. 15:55:43 UTC+1 skrev Sapna Mishra:
> if my_awk command is : -v var="$i" '{print $var} then how i will proceed??
>
> I am doing:
>
> cmd ='awk -v var="$i" '{print $var}' ' + fname[i] + ' > ' + fnameout[i]
> and on:
> print,cmd I am getting:
> IDL> print,cmd
> % PRINT: Variable is undefined: CMD.
> % Execution halted at: $MAIN$

You need to escape the single quotes inside the single-quoted string:

IDL> cmd ='awk -v var="$i" ''{print $var}'' '
IDL> print,cmd
awk -v var="$i" '{print $var}'
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Looping through structures
Next Topic: Segmentation fault (core dumped)

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 13:36:44 PDT 2025

Total time taken to generate the page: 0.00362 seconds