Re: spawn,cmd [message #69877] |
Tue, 02 March 2010 07:47 |
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  |
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.
|
|
|