[CentOS] OT -- BASH

Thu Jun 22 12:57:45 UTC 2006
Rodrigo Barbosa <rodrigob at darkover.org>

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Thu, Jun 22, 2006 at 07:21:22AM -0500, Robert wrote:
> Can someone explain why this:
>   find . -depth -print0 | cpio --null -pmd /tmp/test
> will copy all files in and below the current directory -and- this:
>   find . -depth -print | grep -v .iso$ | wc -l
> will count all the non-iso files -and- this:
>   find . -depth -print | grep  .iso$ | wc -l
> will count *only* the iso files -but- this:
> find . -depth -print0 | grep -v .iso$ | cpio --null -pmd /tmp/test
> doesn't copy *anything*?   
> Any suggestions for a work-around would also be most welcome.

Okey, a new options for you:

find . -depth -print0 | grep -vZ .iso$ | cpio --null -pmd /tmp/test

 From grep manpage:

       -Z, --null
              Output  a  zero  byte  (the ASCII NUL character) instead of the
              character that normally follows a file name.  For example, grep
              -lZ  outputs  a  zero  byte after each file name instead of the
              usual newline.  This option makes the output unambiguous,  even
              in  the  presence  of  file names containing unusual characters
              like newlines.  This option can be used with commands like find
              -print0,  perl  -0,  sort -z, and xargs -0 to process arbitrary
              file names, even those that contain newline characters.


- -- 
Rodrigo Barbosa
"Quid quid Latine dictum sit, altum viditur"
"Be excellent to each other ..." - Bill & Ted (Wyld Stallyns)

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFEmpPJpdyWzQ5b5ckRApYKAJ0aCs6gnSSKRUImBCNrUIFG9M/dTwCfTfl7
EtyZapkWy5KTjShOYrKEOvk=
=S7qC
-----END PGP SIGNATURE-----