Jurian Sluiman
Jurian Sluiman

Reputation: 13558

Xargs doesn't listen to stdin

I try to add an svn:keywords property to all existing *.php and *.phtml files. Therefore, I use this command:

find . -regex '.*\.php' -o -regex '.*\.phtml'|xargs svn propset svn:keywords "Id"

This should, according to Mateusz Loskot, add the property to all files. If I run find . -regex '.*\.php' -o -regex '.*\.phtml', all files are found but xargs returns this message: xargs: svn: No such file or directory.

I also tried to export the found list (>> ~/temp) and use xargs -a to read the arguments from a file input, without success. How can I update all my php files?

PS. I use Kubuntu Linux Natty (11.04), which has built in bash 4.2.8 and xargs 4.4.2 (if that might matter)

Upvotes: 0

Views: 530

Answers (2)

Paweł Nadolski
Paweł Nadolski

Reputation: 8484

Your command looks ok. It seems that xargs cannot find svn command in PATH. Verify that it is available or use full file path (which svn should display full path to svn).

To prevent spaces in file name issue I would recommend -print0 argument for find and -0 for xargs:

find . -name '\*.php' -o -name '\*.phtml' -print0 | xargs -0 svn propset svn:keywords "Id"

Upvotes: 1

Diego Sevilla
Diego Sevilla

Reputation: 29021

You can try the usual tricks here, such as:

find ... | while read i ; do svn propset svn:keywords Id "$i" ; done

Upvotes: 0

Related Questions