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

Home » Public Forums » archive » Re: spawn,cmd
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
Re: spawn,cmd [message #69877] Tue, 02 March 2010 07:47
penteado is currently offline  penteado
Messages: 866
Registered: February 2018
Senior Member
Administrator
On Mar 2, 8:04 am, a <oxfordenergyservi...@googlemail.com> wrote:
> In playing, I have found that...
>
> spawn,'cat in_filename |uniq >out_filename'
>
> actually takes a lot more time than
>
> reading each file in and uniq and writing out in idl

Regardless of efficiency, note that doing it in IDL is more portable.
Re: spawn,cmd [message #69878 is a reply to message #69877] Tue, 02 March 2010 07:37 Go to previous message
mankoff is currently offline  mankoff
Messages: 131
Registered: March 2004
Senior Member
On Mar 2, 3:04 am, a <oxfordenergyservi...@googlemail.com> wrote:
> Hi All
>
> Just a query which I think I have the answer to, in which case it is
> just a comment.
>
> I have to do stuff on about 10,000 files, hundreds of times over and
> it takes a while
>
> In playing, I have found that...
>
> spawn,'cat in_filename |uniq >out_filename'
>
> actually takes a lot more time than
>
> reading each file in and uniq and writing out in idl
>
> I haven't really use spawn too much until recently when I found it is
> simple to use for certain unix commands but hadn't considered what the
> overhead might be.  Is there a standard response to this?  Avoid
> spawns within loops?
>
> Cheers
>
> Russ

You could write the loop in the shell inside spawn...

spawn, 'for v in `ls <some_list_of_files>`; do cat $v | uniq $v.out;
done', status

-k.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: casting error
Next Topic: Re: Grids on Minor Ticks.

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

Current Time: Wed Oct 08 19:00:14 PDT 2025

Total time taken to generate the page: 0.00686 seconds