Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 26 Nov 2002 19:29:52 -0500
From:      Garance A Drosihn <drosih@rpi.edu>
To:        "David S. Jackson" <deepbsd@earthlink.net>, freebsd-questions@FreeBSD.ORG
Subject:   Re: xargs -J
Message-ID:  <p05200f12ba09c1722f85@[128.113.24.47]>
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
At 10:10 PM -0500 11/25/02, 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.

If you're using '-i' with GNU xargs, then you probably don't want
'-J' on the xargs in freebsd.  -J is meant to solve a problem that
can not be handled via -I.

>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?

The man page for xargs says:

        Furthermore, only the first occurrence of the
        replstr will be replaced.

in the description of -J.

For your example, what you should use is -I, not -J.

-- 
Garance Alistair Drosehn            =   gad@gilead.netel.rpi.edu
Senior Systems Programmer           or  gad@freebsd.org
Rensselaer Polytechnic Institute    or  drosih@rpi.edu

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?p05200f12ba09c1722f85>