Re: [CentOS] OT -- BASH

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



-----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-----
_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
http://lists.centos.org/mailman/listinfo/centos

[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]
  Powered by Linux