Projects / Keep / Comments

Comments for Keep

19 Sep 2004 13:08 niggerbottom

Re: Other way to do it


>

> % Hi, well, maybe you already know

> this,

> % but under bash with the extglob shell

> % option enabled, you can do this:

> %

> % rm !(file1 file2)

> %

> % to remove everything but file1 and

> % file2.

>

>

>

> Or even,

>

> ls | egrep -v '(REGEXP1|REGEXP2|...)' |

> xargs rm # in most any shell

>

> ...without digging through the manpage,

> I'm certain `find' could also be coaxed

> into doing something like this as

> well.

>

alternatively:

rm `/bin/ls | grep -v PATTERN`

26 May 2004 06:19 rodlima

Re: Other way to do it


> That's what I love about UNIX...so many

> different ways to do things! :-)

>

> Anyway...I'll keep working on this and

> make it even more powerful.

>

"so many different ways to do things"... it sounds scary to me :) but good luck then!

21 May 2004 06:22 the_trapper

Re: Other way to do it


> Hi, well, maybe you already know this,

> but under bash with the extglob shell

> option enabled, you can do this:

>

> rm !(file1 file2)

>

> to remove everything but file1 and

> file2.

Thanks, actually I didn't know this. I think you would agree that Keep is a little more "user friendly" than this, however.

That's what I love about UNIX...so many different ways to do things! :-)

Anyway...I'll keep working on this and make it even more powerful.

20 May 2004 14:14 bobBillll

Re: Other way to do it


> Hi, well, maybe you already know this,

> but under bash with the extglob shell

> option enabled, you can do this:

>

> rm !(file1 file2)

>

> to remove everything but file1 and

> file2.

Or even,

ls | egrep -v '(REGEXP1|REGEXP2|...)' | xargs rm # in most any shell

...without digging through the manpage, I'm certain `find' could also be coaxed into doing something like this as well.

20 May 2004 09:35 rodlima

Other way to do it
Hi, well, maybe you already know this, but under bash with the extglob shell option enabled, you can do this:

rm !(file1 file2)

to remove everything but file1 and file2.

Screenshot

Project Spotlight

ReciJournal

An open, cross-platform journaling program.

Screenshot

Project Spotlight

Veusz

A scientific plotting package.