find with -print0 returns incorrect results
Luciano Rocha
strange at nsk.no-ip.org
Sat Dec 8 13:57:11 UTC 2007
On Sat, Dec 08, 2007 at 02:27:19PM +0200, Razvan RACASANU wrote:
> Hi,
>
> I'm having some problems using find with -print0: it is returning
> different files depending on the position of -print0.
Yes, position matters in find. Think of -print0 of just another test.
> To illustrate this, suppose the current directory has 3 files: a.html,
> a.css and a.js. From this directory I would like to list the file
> names of all html and js files, but not those of css files.
>
> If I try this:
> find . -type f -print0 -iname "*.html" -or -iname "*.js" | xargs -0
<snip>
What you want:
find . -type f \( -iname '*.html' -o -iname '*.js' \) -print0
--
lfr
0/0
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/fedora-list/attachments/20071208/8795e8ec/attachment-0001.sig>
More information about the fedora-list
mailing list