[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug #51220] [wishlist] Using -I with -n

From: Bernhard Voelker
Subject: [bug #51220] [wishlist] Using -I with -n
Date: Sun, 11 Jun 2017 16:09:45 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:50.0) Gecko/20100101 Firefox/50.0

Update of bug #51220 (project findutils):

                Category:                    None => xargs                  
             Assigned to:                    None => berny                  


Follow-up Comment #3:

The -I option already implies "-n 1" ... but - as POSIX [1]
says - the input is treated to be separated by newlines instead
of blanks.

[1] http://pubs.opengroup.org/onlinepubs/9699919799/utilities/xargs.html

-I  replstr
    [XSI] [Option Start] Insert mode: utility is executed for each
    logical line from standard input. Arguments in the standard input
    shall be separated only by unescaped <newline> characters, not
    by <blank> characters. [...]

That's exactly what GNU xargs does; example:

  $ printf "%s\n" one two three four \
      | xargs -I{} echo cp -v "/tmp/{}" /tmp/test
  cp -v /tmp/one /tmp/test
  cp -v /tmp/two /tmp/test
  cp -v /tmp/three /tmp/test
  cp -v /tmp/four /tmp/test

I think it's documented well enough both in GNU xarg's man page
and (similarly) in the Texinfo manual:

 -I replace-str
     [...]  Also, unquoted blanks do not  terminate input items;
     instead the separator is the newline character. [...]

This is only missing for brevity in 'xargs --help' output.

Therefore, this is not a bug in the software, and implementing the
wish would clearly contradict to POSIX and break existing scripts.
Thus, I think I'll mark this as INVALID soon.

BTW: if you're sure to have GNU cp, then you could avoid the -I option
in the above example by using cp's --target option:

  $ echo some files | xargs cp -vt /tmp/test

Have a nice day,


Reply to this item at:


  Message sent via/by Savannah

reply via email to

[Prev in Thread] Current Thread [Next in Thread]