只需要获取 svn grn 中更改的文件(而不是创建分支)。为此我正在尝试这样:
情况1 :
echo " M /branches/Integration_release_23_branch/build/scripts/include/test.h" | \
grep -E " . /[trunk/,branches].*[^from\ ]"
这应该匹配(并且它正在工作)
案例2:
echo " A /branches/Integration_release_23_branch (from /branches/Integration_release_22_branch:34500)" | grep -E " . /[trunk/,branches].*[^from\ ]"
这不应该匹配(需要在末尾检查(from
or ))
我无法让异常字符串正常工作。
答案1
给定这个输入文件:
$ cat ip.txt
M /branches/Integration_release_23_branch/build/scripts/include/test.h
A /branches/Integration_release_23_branch (from /branches/Integration_release_22_branch:34500)
dummy line 1
M /trunk/Integration_release_23_branch/build/scripts/include/test.h
dummy line 2
A /trunk/Integration_release_23_branch (from /branches/Integration_release_22_branch:34500)
用于|
搜索这个或那个模式
$ grep -E 'trunk|branches' ip.txt
M /branches/Integration_release_23_branch/build/scripts/include/test.h
A /branches/Integration_release_23_branch (from /branches/Integration_release_22_branch:34500)
M /trunk/Integration_release_23_branch/build/scripts/include/test.h
A /trunk/Integration_release_23_branch (from /branches/Integration_release_22_branch:34500)
可以使用选项 将结果定向到另一个grep
命令以排除from
-v
$ grep -E 'trunk|branches' ip.txt | grep -v 'from '
M /branches/Integration_release_23_branch/build/scripts/include/test.h
M /trunk/Integration_release_23_branch/build/scripts/include/test.h