Вывод оболочки в команду svn del?

7
задан Melebius 14 September 2017 в 07:22
поделиться

3 ответа

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.

10
ответ дан 6 December 2019 в 23:10
поделиться
svn st | egrep ^! | cut -b 9- | xargs svn del
1
ответ дан 6 December 2019 в 23:10
поделиться

В качестве альтернативы вышеперечисленным я бы использовал что-то вроде:

svn st | awk '$1=="!"{print $2}' | xargs svn del

Я считаю язык сопоставления шаблонов в awk очень удобным для таких задач.

0
ответ дан 6 December 2019 в 23:10
поделиться
Другие вопросы по тегам:

Похожие вопросы: