Perform 'find' command (LINUX) in IDL environment [message #91029] |
Wed, 27 May 2015 00:34  |
Kai Heckel
Messages: 51 Registered: April 2015
|
Member |
|
|
Hey there!
For reasons of processing time I'd like to replace a 'FILE_SEARCH' command with a faster 'find' LINUX command.
Here is what I have so far...
mydir = 'F:\startdir\anotherdir\maindir\data'
cd, mydir
spawn, 'pwd'
spawn, 'find' -type f -name "*132.txt"
The result should be every text file ending with "132.txt".
Where am I going wrong here?
Thanks,
Kai
|
|
|
Re: Perform 'find' command (LINUX) in IDL environment [message #91030 is a reply to message #91029] |
Wed, 27 May 2015 00:55   |
Helder Marchetto
Messages: 520 Registered: November 2011
|
Senior Member |
|
|
On Wednesday, May 27, 2015 at 9:34:09 AM UTC+2, Kai Heckel wrote:
> Hey there!
> For reasons of processing time I'd like to replace a 'FILE_SEARCH' command with a faster 'find' LINUX command.
>
> Here is what I have so far...
>
> mydir = 'F:\startdir\anotherdir\maindir\data'
> cd, mydir
> spawn, 'pwd'
> spawn, 'find' -type f -name "*132.txt"
>
>
> The result should be every text file ending with "132.txt".
> Where am I going wrong here?
>
> Thanks,
> Kai
Hi,
I have no Linux to test this, but the spawn command expects a string as argument. Therefore I would do something like:
spawn, 'find -type f -name "*132.txt"'
Not tested!
Cheers,
Helder
|
|
|
Re: Perform 'find' command (LINUX) in IDL environment [message #91031 is a reply to message #91030] |
Wed, 27 May 2015 01:19   |
Kai Heckel
Messages: 51 Registered: April 2015
|
Member |
|
|
Am Mittwoch, 27. Mai 2015 09:55:55 UTC+2 schrieb Helder:
> On Wednesday, May 27, 2015 at 9:34:09 AM UTC+2, Kai Heckel wrote:
>> Hey there!
>> For reasons of processing time I'd like to replace a 'FILE_SEARCH' command with a faster 'find' LINUX command.
>>
>> Here is what I have so far...
>>
>> mydir = 'F:\startdir\anotherdir\maindir\data'
>> cd, mydir
>> spawn, 'pwd'
>> spawn, 'find' -type f -name "*132.txt"
>>
>>
>> The result should be every text file ending with "132.txt".
>> Where am I going wrong here?
>>
>> Thanks,
>> Kai
>
> Hi,
> I have no Linux to test this, but the spawn command expects a string as argument. Therefore I would do something like:
>
> spawn, 'find -type f -name "*132.txt"'
>
> Not tested!
>
> Cheers,
> Helder
Perfect, this works, thanks for that.
How can I store the search results in a variable in order to use them in IDL.
Something like this:
results = spawn, 'find -type f -name "*132.txt"'
|
|
|
Re: Perform 'find' command (LINUX) in IDL environment [message #91032 is a reply to message #91031] |
Wed, 27 May 2015 01:27   |
Helder Marchetto
Messages: 520 Registered: November 2011
|
Senior Member |
|
|
On Wednesday, May 27, 2015 at 10:19:45 AM UTC+2, Kai Heckel wrote:
> Am Mittwoch, 27. Mai 2015 09:55:55 UTC+2 schrieb Helder:
>> On Wednesday, May 27, 2015 at 9:34:09 AM UTC+2, Kai Heckel wrote:
>>> Hey there!
>>> For reasons of processing time I'd like to replace a 'FILE_SEARCH' command with a faster 'find' LINUX command.
>>>
>>> Here is what I have so far...
>>>
>>> mydir = 'F:\startdir\anotherdir\maindir\data'
>>> cd, mydir
>>> spawn, 'pwd'
>>> spawn, 'find' -type f -name "*132.txt"
>>>
>>>
>>> The result should be every text file ending with "132.txt".
>>> Where am I going wrong here?
>>>
>>> Thanks,
>>> Kai
>>
>> Hi,
>> I have no Linux to test this, but the spawn command expects a string as argument. Therefore I would do something like:
>>
>> spawn, 'find -type f -name "*132.txt"'
>>
>> Not tested!
>>
>> Cheers,
>> Helder
>
> Perfect, this works, thanks for that.
>
> How can I store the search results in a variable in order to use them in IDL.
>
> Something like this:
>
> results = spawn, 'find -type f -name "*132.txt"'
Look at the spawn documentation: http://www.exelisvis.com/docs/SPAWN.html
The synthax is:
SPAWN [, Command [, Result] [, ErrResult] ]
and result is what you need.
So that should rather look like:
spawn, 'find -type f -name "*132.txt"', myOutput
print, myOutput
cheers,
Helder
|
|
|
Re: Perform 'find' command (LINUX) in IDL environment [message #91033 is a reply to message #91032] |
Wed, 27 May 2015 02:04   |
Kai Heckel
Messages: 51 Registered: April 2015
|
Member |
|
|
Am Mittwoch, 27. Mai 2015 10:27:56 UTC+2 schrieb Helder:
> On Wednesday, May 27, 2015 at 10:19:45 AM UTC+2, Kai Heckel wrote:
>> Am Mittwoch, 27. Mai 2015 09:55:55 UTC+2 schrieb Helder:
>>> On Wednesday, May 27, 2015 at 9:34:09 AM UTC+2, Kai Heckel wrote:
>>>> Hey there!
>>>> For reasons of processing time I'd like to replace a 'FILE_SEARCH' command with a faster 'find' LINUX command.
>>>>
>>>> Here is what I have so far...
>>>>
>>>> mydir = 'F:\startdir\anotherdir\maindir\data'
>>>> cd, mydir
>>>> spawn, 'pwd'
>>>> spawn, 'find' -type f -name "*132.txt"
>>>>
>>>>
>>>> The result should be every text file ending with "132.txt".
>>>> Where am I going wrong here?
>>>>
>>>> Thanks,
>>>> Kai
>>>
>>> Hi,
>>> I have no Linux to test this, but the spawn command expects a string as argument. Therefore I would do something like:
>>>
>>> spawn, 'find -type f -name "*132.txt"'
>>>
>>> Not tested!
>>>
>>> Cheers,
>>> Helder
>>
>> Perfect, this works, thanks for that.
>>
>> How can I store the search results in a variable in order to use them in IDL.
>>
>> Something like this:
>>
>> results = spawn, 'find -type f -name "*132.txt"'
>
> Look at the spawn documentation: http://www.exelisvis.com/docs/SPAWN.html
> The synthax is:
> SPAWN [, Command [, Result] [, ErrResult] ]
> and result is what you need.
> So that should rather look like:
> spawn, 'find -type f -name "*132.txt"', myOutput
> print, myOutput
>
> cheers,
> Helder
Somehow the variable 'myOutput' is empty... no files are found.
I thought I might be in the wrong directory, so I typed: spawn, 'pwd'
... but IDL didn't print anything. Shouldn't the 'mydir' appear after that command?
|
|
|
Re: Perform 'find' command (LINUX) in IDL environment [message #91035 is a reply to message #91033] |
Wed, 27 May 2015 03:48  |
Lajos Foldy
Messages: 176 Registered: December 2011
|
Senior Member |
|
|
On Wednesday, May 27, 2015 at 11:04:50 AM UTC+2, Kai Heckel wrote:
> Am Mittwoch, 27. Mai 2015 10:27:56 UTC+2 schrieb Helder:
>> On Wednesday, May 27, 2015 at 10:19:45 AM UTC+2, Kai Heckel wrote:
>>> Am Mittwoch, 27. Mai 2015 09:55:55 UTC+2 schrieb Helder:
>>>> On Wednesday, May 27, 2015 at 9:34:09 AM UTC+2, Kai Heckel wrote:
>>>> > Hey there!
>>>> > For reasons of processing time I'd like to replace a 'FILE_SEARCH' command with a faster 'find' LINUX command.
>>>> >
>>>> > Here is what I have so far...
>>>> >
>>>> > mydir = 'F:\startdir\anotherdir\maindir\data'
>>>> > cd, mydir
>>>> > spawn, 'pwd'
>>>> > spawn, 'find' -type f -name "*132.txt"
>>>> >
>>>> >
>>>> > The result should be every text file ending with "132.txt".
>>>> > Where am I going wrong here?
>>>> >
>>>> > Thanks,
>>>> > Kai
>>>>
>>>> Hi,
>>>> I have no Linux to test this, but the spawn command expects a string as argument. Therefore I would do something like:
>>>>
>>>> spawn, 'find -type f -name "*132.txt"'
>>>>
>>>> Not tested!
>>>>
>>>> Cheers,
>>>> Helder
>>>
>>> Perfect, this works, thanks for that.
>>>
>>> How can I store the search results in a variable in order to use them in IDL.
>>>
>>> Something like this:
>>>
>>> results = spawn, 'find -type f -name "*132.txt"'
>>
>> Look at the spawn documentation: http://www.exelisvis.com/docs/SPAWN.html
>> The synthax is:
>> SPAWN [, Command [, Result] [, ErrResult] ]
>> and result is what you need.
>> So that should rather look like:
>> spawn, 'find -type f -name "*132.txt"', myOutput
>> print, myOutput
>>
>> cheers,
>> Helder
>
> Somehow the variable 'myOutput' is empty... no files are found.
> I thought I might be in the wrong directory, so I typed: spawn, 'pwd'
> ... but IDL didn't print anything. Shouldn't the 'mydir' appear after that command?
Try this:
spawn, 'find F:/startdir/anotherdir/maindir/data -type f -name "*132.txt"', myOutput
(You said Linux, so I have replaced backslashes with forward slashes.)
regards,
Lajos
|
|
|