Re: rm in a regular expression
- From: Ben Bacarisse <ben.usenet@xxxxxxxxx>
- Date: Wed, 07 Jul 2010 14:16:19 +0100
franzi <hazzino@xxxxxxxxx> writes:
Hi there, it's been a while that i'm not join'g the group
i need some tips..under Leopard is there a way to rm the file not
converted
I was puzzled by your use of "not converted"...
textutil -convert html gnu.webarchive i will have gnu.html
i would like to remove the gnu.webarchive can i do like this
textutil -convert html gnu.webarchive| rm {} ?????
but working back from this I think you want to remove the source file
when the conversion fails (presumably because un-convertable file are of
no use to you). You can do that with:
textutil -convert html gnu.webarchive || rm gnu.webarchive
(You may not need "rm -f" but let's keep things simple for now.) The ||
executes the rm command only if the first command fails.
Your use of {} suggests that you'd like to do this without repeating the
file name. For that I'd write a shell function:
function convert_and_remove
{
textutil -convert html "$1" || rm "$1"
}
which you can use in a script or directly from the command line, but
please don't use this without checking that I've understood your intent!
--
Ben.
.
- Follow-Ups:
- Re: rm in a regular expression
- From: Barry Margolin
- Re: rm in a regular expression
- From: franzi
- Re: rm in a regular expression
- References:
- rm in a regular expression
- From: franzi
- rm in a regular expression
- Prev by Date: rm in a regular expression
- Next by Date: Re: rm in a regular expression
- Previous by thread: rm in a regular expression
- Next by thread: Re: rm in a regular expression
- Index(es):
Relevant Pages
|