find with -print0 returns incorrect results

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

 



Hi,

I'm having some problems using find with -print0: it is returning
different files depending on the position of -print0.

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
the result looks like this:
    ./a.html        ./a.js        ./a.css

If I try this:
    find . -print0 -type f -iname "*.html" -or -iname "*.js" | xargs -0
the result looks like this:
    .        ./a.html        ./a.css

If I try this:
    find . -type f -iname "*.html" -or -iname "*.js" -print0 | xargs -0
the result looks like this:
    ./a.js

Can anybody shed some light on what am I doing wrong?

Thanks,
Razvan RACASANU


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux