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

Home » Public Forums » archive » Re: unix/idl question
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: unix/idl question [message #67104] Mon, 22 June 2009 09:08
Carsten Lechte is currently offline  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 Go to previous message
oxfordenergyservices is currently offline  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 Go to previous message
Foldy Lajos is currently offline  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
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: unix/idl question
Next Topic: Centering Image

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

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

Total time taken to generate the page: 0.00626 seconds