Try using xargs
, like this:
svn st | grep ^! | cut -f2 | xargs svn rm
The xargs
command takes lines on its standard input, and turns them around and uses those lines as command line parameters on the svn rm
. By default, xargs
uses multiple lines with each invocation of its command, which in the case of svm rm
is fine.
You may also have to experiment with the cut
command to get it just right. By default, cut
uses a tab as a delimiter and Subversion may output spaces there. In that case, you may have to use cut -d' ' -f6
or something.
As always when building such a command pipeline, run portions at a time to make sure things look right. So run everything up to the cut
command to ensure that you have the list of file names you expect, before running it again with "| xargs svn rm"
on the end.
В качестве альтернативы вышеперечисленным я бы использовал что-то вроде:
svn st | awk '$1=="!"{print $2}' | xargs svn del
Я считаю язык сопоставления шаблонов в awk очень удобным для таких задач.