bug-findutils
[Top][All Lists]
Advanced

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

[bug #39824] Add suggestion 'ls | tr \\n \\0 | xargs -0 command' to xarg


From: Edward J. Huff
Subject: [bug #39824] Add suggestion 'ls | tr \\n \\0 | xargs -0 command' to xargs man page
Date: Tue, 20 Aug 2013 07:50:54 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:23.0) Gecko/20100101 Firefox/23.0

URL:
  <http://savannah.gnu.org/bugs/?39824>

                 Summary: Add suggestion 'ls | tr \\n \\0 | xargs -0 command'
to xargs man page
                 Project: findutils
            Submitted by: ejhuff
            Submitted on: Tue 20 Aug 2013 07:50:53 AM GMT
                Category: documentation
                Severity: 3 - Normal
              Item Group: None
                  Status: None
                 Privacy: Public
             Assigned to: None
         Originator Name: Edward Huff
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
                 Release: None
           Fixed Release: None

    _______________________________________________________

Details:

After this paragraph in the *xargs* man page:

       Because Unix filenames can contain blanks
       and newlines, this default  behaviour  is
       often  problematic;  filenames containing
       blanks and/or  newlines  are  incorrectly
       processed  by *xargs*.  In these situations
       it is better to use the *-0* option,  which
       prevents such problems.   When using this
       option you will need to ensure  that  the
       program  which  produces  the  input  for
       *xargs* also uses a  null  character  as  a
       separator.   If  that program is GNU *find*
       for example, the *-print0* option does this
       for you.

Insert a new paragraph:

In the much more common case, Unix filenames
contain blank spaces but not newlines, and
furthermore, the input program has no *-0* option.
In that case, you can ensure correct operation
by inserting *tr \\n \\0* into the
pipeline just before *xargs -0*.  For example,

   *ls | grep* _regexp_ *| tr \\n \\0 | xargs -0 stat*

to stat all filenames matching _regexp_.




    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?39824>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

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