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

Home » Public Forums » archive » AWK inside idl
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
AWK inside idl [message #92761] Thu, 25 February 2016 11:18 Go to next message
Sapna Mishra is currently offline  Sapna Mishra
Messages: 66
Registered: December 2015
Member
Hello all,

How can I use awk command inside idl? I am doing:

spawn, "awk '{print $1 }' data2.dat >tmp1"

It is showing no error in IDL prompt but the file tmp1 is not getting created. My data2.dat is not empty. Any help in this regard???
Re: AWK inside idl [message #92763 is a reply to message #92761] Thu, 25 February 2016 17:46 Go to previous messageGo to next message
Michael Galloy is currently offline  Michael Galloy
Messages: 1114
Registered: April 2006
Senior Member
On 2/25/16 12:18 PM, Sapna Mishra wrote:
> Hello all,
>
> How can I use awk command inside idl? I am doing:
>
> spawn, "awk '{print $1 }' data2.dat >tmp1"
>
> It is showing no error in IDL prompt but the file tmp1 is not getting
> created. My data2.dat is not empty. Any help in this regard???
>

Use the result and error_result output params to see what is happening:

IDL> spawn, "awk '{print $1 }' data2.dat >tmp1", result, error_result
IDL> print, result
IDL> print, error_result

Mike
--
Michael Galloy
www.michaelgalloy.com
Modern IDL: A Guide to IDL Programming (http://modernidl.idldev.com)
Re: AWK inside idl [message #92765 is a reply to message #92761] Thu, 25 February 2016 20:24 Go to previous messageGo to next message
Sapna Mishra is currently offline  Sapna Mishra
Messages: 66
Registered: December 2015
Member
IDL> spawn, "awk '{print $2 }' data2.dat >tmp1", result, error_result
IDL> print,result

IDL>

This is not working as well, basically I am interested in tmp1 file to be created inside IDL with column 1 of data2.dat. But with this no tmp1 is getting created.
Any other suggestion please???
Re: AWK inside idl [message #92766 is a reply to message #92765] Thu, 25 February 2016 21:23 Go to previous messageGo to next message
Michael Galloy is currently offline  Michael Galloy
Messages: 1114
Registered: April 2006
Senior Member
On 2/25/16 9:24 PM, Sapna Mishra wrote:
> IDL> spawn, "awk '{print $2 }' data2.dat >tmp1", result, error_result
> IDL> print,result
>
> IDL>
>
> This is not working as well, basically I am interested in tmp1 file
> to
be created inside IDL with column 1 of data2.dat. But with this no tmp1
is getting created.
> Any other suggestion please???
>

What about error_result? That is the one we want to see.

Mike
--
Michael Galloy
www.michaelgalloy.com
Modern IDL: A Guide to IDL Programming (http://modernidl.idldev.com)
Re: AWK inside idl [message #92767 is a reply to message #92761] Thu, 25 February 2016 21:50 Go to previous messageGo to next message
Sapna Mishra is currently offline  Sapna Mishra
Messages: 66
Registered: December 2015
Member
IDL> spawn, "awk '{print $2 }' data2.dat >tmp1", result, error_result
IDL> print,error_result

IDL>

i.e it is not printing anything
Re: AWK inside idl [message #92770 is a reply to message #92767] Fri, 26 February 2016 01:33 Go to previous messageGo to next message
Mats Löfdahl is currently offline  Mats Löfdahl
Messages: 263
Registered: January 2012
Senior Member
Den fredag 26 februari 2016 kl. 06:50:26 UTC+1 skrev Sapna Mishra:
> IDL> spawn, "awk '{print $2 }' data2.dat >tmp1", result, error_result
> IDL> print,error_result
>
> IDL>
>
> i.e it is not printing anything

You say data2.dat is not empty, but does it have any lines with the second field that $2 refers to? Do you get any tmp1 file if you execute the awk command directly at the shell prompt?

Hmmm, I guess if there are no second fields the file should still be created but with empty lines.
Re: AWK inside idl [message #92771 is a reply to message #92761] Fri, 26 February 2016 02:07 Go to previous messageGo to next message
Sapna Mishra is currently offline  Sapna Mishra
Messages: 66
Registered: December 2015
Member
data2.dat is having 6 column so there is no issue of an empty field. However still tpm2 should be created .
Re: AWK inside idl [message #92773 is a reply to message #92771] Fri, 26 February 2016 05:38 Go 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. 11:07:24 UTC+1 skrev Sapna Mishra:
> data2.dat is having 6 column so there is no issue of an empty field. However still tpm2 should be created .

But is it, if you do not involve IDL?
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Big array saving less value to a file
Next Topic: list concatenation

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

Current Time: Wed Oct 08 09:13:28 PDT 2025

Total time taken to generate the page: 0.00704 seconds