Skip site navigation (1)Skip section navigation (2)
Date:      26 Nov 2002 13:26:47 +1000
From:      Duncan Anker <d.anker@au.darkbluesea.com>
To:        "David S. Jackson" <deepbsd@earthlink.net>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: xargs -J
Message-ID:  <1038281207.1512.41.camel@duncan.au.darkbluesea.com>
In-Reply-To: <20021125221003.A19207@sylvester.dsj.net>
References:  <20021125221003.A19207@sylvester.dsj.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 2002-11-26 at 13:10, David S. Jackson wrote:
> Hi,
> 
> I've been trying to use |xargs -J [] mv [] [].suffix
> 
> but to no avail.
> 
> I've tried |xargs -J mv \[\] \[\].suffix and variations but that
> doesn't seem to work either.  It seems to work fine with the -i
> command under GNU xargs, but not under Freebsd.
> 
> An example would be 
> 
> $  touch one two three
> $  ls one two three | xargs -J [] mv [] [].suffix
> 
> I should now have one.suffix two.suffix three.suffix.  At least,
> that's what happens with GNU and the -i \{\}.  (FreeBSD manpage says
> to use -J [] without escapes though.)
> 
> Can anyone lend me a clue here please?

I've never tried to do it this way, but I suspect that you can only use
your delimiter once.

In any case, if what you are wanting to do is rename a bunch of files,
try something like:

# for file in one two three; do mv $file `echo $file | sed -e
's/$/.suffix/'`; done

That's the way I've always done it - works a treat (try doing THAT with
a GUI :-)

Hope it helps, unless you had your heart set on xargs

Regards,

Duncan Anker
Senior Systems Administrator
Dark Blue Sea

-- 

The information contained in this email is confidential.
If you are not the intended recipient, you may not disclose or use the
information in this email in any way.
Dark Blue Sea does not guarantee the integrity of any emails or attached
files.
The views or opinions expressed are the author's own and may not reflect
the views or opinions of Dark Blue Sea.
Dark Blue Sea does not warrant that any attachments are free from
viruses or other defects.
You assume all liability for any loss, damage or other consequences
which may arise from opening or using the attachments.


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1038281207.1512.41.camel>