[CentOS] OT -- BASH

Thu Jun 22 12:41:51 UTC 2006
William L. Maltby <BillsCentOS at triad.rr.com>

On Thu, 2006-06-22 at 07:21 -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.

Replace the print0 with print. If you need to know why, redirect your
find print0 output to a file & then do an od -c on it.

Hint: cpio expects one entry per line (in spite of what it did for you)
and grep operates on lines of input. If it's not clear after doing the
od -c, call again.  :-)

BTW, this is not a wise-acre reply. I've always been victimized by the
unexpected behavior of the utilities (my fault, not their's...
*usually*) and have become somewhat adept at discovery of underlying
cause. The method I post above is just sharing my experience.

Oh! Also, a vi on the two files (made by print0 and print) will give an
indication.

> <snip>

HTH
-- 
Bill
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://lists.centos.org/pipermail/centos/attachments/20060622/569b7db2/attachment-0005.sig>