From: franzi on
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
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 {} ?????
Thanks in advanced
From: Ben Bacarisse on
franzi <hazzino(a)gmail.com> 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.
From: franzi on
On 7 Lug, 15:16, Ben Bacarisse <ben.use...(a)bsb.me.uk> wrote:
> franzi <hazz...(a)gmail.com> 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.

Your Intend is right,thank you very much,i will try right now
From: franzi on
On 7 Lug, 15:21, franzi <hazz...(a)gmail.com> wrote:
> On 7 Lug, 15:16, Ben Bacarisse <ben.use...(a)bsb.me.uk> wrote:
>
>
>
>
>
> > franzi <hazz...(a)gmail.com> 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.
>
> Your Intend is right,thank you very much,i will try right now

I tried your scripts trough cmd line but the rm is not working
From: Ben Bacarisse on
franzi <hazzino(a)gmail.com> writes:

> On 7 Lug, 15:21, franzi <hazz...(a)gmail.com> wrote:
>> On 7 Lug, 15:16, Ben Bacarisse <ben.use...(a)bsb.me.uk> wrote:
<snip>
>> > 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"
>> >   }
<snip>
>> > --
>> > Ben.

It is usual to snip sig blocks, even small ones.

>> Your Intend is right,thank you very much,i will try right now
>
> I tried your scripts trough cmd line but the rm is not working

"not working" is not very helpful. What, exactly, did you type? Are
there any clues like an error message? What are the permissions and
ownership of the file in question[1]? What is the returned result from
the textutil command on its own[2]?

[1] What do "ls -l gnu.webarchive" and "whoami" say? The permissions on
the directory may also matter ("ls -ld .").
[2] What does "echo $?" say immediately after "textutil -convert html
gnu.webarchive"?

--
Ben.