Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 25 Nov 2002 23:57:35 -0600 (CST)
From:      Conrad Sabatier <conrads@cox.net>
To:        "David S. Jackson" <deepbsd@earthlink.net>
Cc:        freebsd-questions@FreeBSD.ORG
Subject:   Re: xargs -J
Message-ID:  <XFMail.20021125235735.conrads@cox.net>
In-Reply-To: <20021125221003.A19207@sylvester.dsj.net>

next in thread | previous in thread | raw e-mail | index | archive | help

On 26-Nov-2002 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 think what you want here is -I instead of -J.  -I allows for multiple
replacements, whereas -J does not.

Also, I'd suggest using something other than [] as your placeholder, as
those characters have a special meaning in the shell.  Using something
simple, like %, as the man page illustrates.

-- 
Conrad Sabatier <conrads@cox.net>

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?XFMail.20021125235735.conrads>