Re: unix/idl question [message #67104] |
Mon, 22 June 2009 09:08 |
Carsten Lechte
Messages: 124 Registered: August 2006
|
Senior Member |
|
|
a wrote:
> spawn,'cd temp'
> spawn,'ls -l | grep raw | awk '{print $9}' | xargs rm '
spawn, 'cd temp ; ls -l | ...'
this way, the cd and the ls happen in the same spawn-process. You
could also do 'ls temp | grep raw$ | xargs rm', or use find, as someone else has
suggested.
chl
|
|
|
Re: unix/idl question [message #67106 is a reply to message #67104] |
Mon, 22 June 2009 05:35  |
oxfordenergyservices
Messages: 56 Registered: January 2009
|
Member |
|
|
On 22 June, 12:55, FĂ–LDY Lajos <fo...@rmki.kfki.hu> wrote:
> On Mon, 22 Jun 2009, a wrote:
>> Hi
>
>> I am having a problem that i want to delete many files with the 'raw'
>> extension in folder temp
>
>> in unix
>
>> cd temp
>> rm *raw
>> /bin/rm: Argument list too long.
>
>> ok, so
>
>> cd temp
>> ls -l | grep raw | awk '{print $9}' | xargs rm
>
>> works ok
>
>> but I have to be in the directory to do it
>
>> I want to do the same from idl and not being in the temp directory
>
>> ie
>
>> spawn,'cd temp'
>> spawn,'ls -l | grep raw | awk '{print $9}' | xargs rm '
>
>> but the first spawn does not leave me in the temp directory
>
>> any ideas?
>
>> Thanks
>
>> Russ
>
> find /tmp/ -name '*raw' | xargs rm
>
> or (for files with whitespace in the names):
>
> find /tmp/ -name '*raw' -print0 | xargs -0 rm
>
> regards,
> lajos
many thanks! works a treat
Russ
|
|
|
Re: unix/idl question [message #67108 is a reply to message #67106] |
Mon, 22 June 2009 04:55  |
Foldy Lajos
Messages: 268 Registered: October 2001
|
Senior Member |
|
|
On Mon, 22 Jun 2009, a wrote:
> Hi
>
> I am having a problem that i want to delete many files with the 'raw'
> extension in folder temp
>
> in unix
>
> cd temp
> rm *raw
> /bin/rm: Argument list too long.
>
> ok, so
>
> cd temp
> ls -l | grep raw | awk '{print $9}' | xargs rm
>
> works ok
>
> but I have to be in the directory to do it
>
> I want to do the same from idl and not being in the temp directory
>
> ie
>
> spawn,'cd temp'
> spawn,'ls -l | grep raw | awk '{print $9}' | xargs rm '
>
> but the first spawn does not leave me in the temp directory
>
> any ideas?
>
> Thanks
>
> Russ
>
>
find /tmp/ -name '*raw' | xargs rm
or (for files with whitespace in the names):
find /tmp/ -name '*raw' -print0 | xargs -0 rm
regards,
lajos
|
|
|