Re: xargs -J

2002-11-26 Thread Garance A Drosihn
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=   [EMAIL PROTECTED]
Senior Systems Programmer   or  [EMAIL PROTECTED]
Rensselaer Polytechnic Instituteor  [EMAIL PROTECTED]

To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-questions in the body of the message



xargs -J

2002-11-25 Thread David S. Jackson
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?

TIA.

-- 
David S. Jackson[EMAIL PROTECTED]
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
I have a map of the United States.  It's actual size.
I spent last summer folding it.  People ask me where
I live, and I say, E6.  -- Steven Wright

To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-questions in the body of the message



Re: xargs -J

2002-11-25 Thread Duncan Anker
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 [EMAIL PROTECTED]
with unsubscribe freebsd-questions in the body of the message



Re: xargs -J

2002-11-25 Thread Nathan Kinkade
On Mon, Nov 25, 2002 at 10:10:03PM -0500, 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?
 
 TIA.
 
 -- 
 David S. Jackson[EMAIL PROTECTED]

Two things.  First, from `man xargs`:
Furthermore, only the first occurrence of the replstr will be
replaced.  Second, maybe a different tool would be better.  How 
about:
$ for file in `ls one two three`; do move $file $file.suffix; done

Nathan

To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-questions in the body of the message



Re: xargs -J

2002-11-25 Thread Conrad Sabatier

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 [EMAIL PROTECTED]

To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-questions in the body of the message