This is the mail archive of the cygwin-talk mailing list for the cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

find, xargs and spaces


If file names and directories identified by "find" do not contain spaces
then the command

find . | xargs .. | xargs .. | xargs ..

can be chained almost indefinitely. If there are spaces in the names

find . -print0 | xargs -0 ..

works but

find . -print0 | xargs -0 .. | xargs -0 ..

fails. (As an example I might want to identify all files containing ^L
which do not contain NUL:

find . | xargs grep -PL "\x00" | xargs grep -Pl "\x0c"

works as long as there are no spaces in the pathname but, when there are,

find . -print0 | xargs -0 grep -PL "\x00" | xargs -0 grep -Pl "\x0c"

fails.) (There are probably alternative ways of attacking this specific
problem that avoid the -print0 .. -0 .. but I would be interested in a
general solution.)

I know this is not Cygwin-specific but if there is a simple answer I
would really appreciate the help.

Thank you.

Fergus




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]