This command will add any un-versioned files listed in svn st command output to subversion.

Note that any filenames containing whitespace in the svn stat output will not be added. Further, odd behavior might occur if any filenames contain '?'s.

svn st | grep ? | tr -s ' ' | cut -d ' ' -f 2 | xargs svn add

or if you are good at awk:

svn st | grep ? | awk '{print $2}' | xargs svn add

Explanation:

Step 1: svn st command

[user@xxx rails]$svn st
? app/controllers/application.rb
M app/views/layouts/application.html.erb
? config/database.yml

Step 2: We grep the un-versioned file with grep command:

[user@xxx rails]$svn st | grep ?
? app/controllers/application.rb
? config/database.yml

Step 3: Then remove the squeeze the space between ? and file path by using tr command:

[user@xxx rails]$svn st | grep ? | tr -s ' '
? app/controllers/application.rb
? config/database.yml
</pre>

Step 4: Then select second column from the output by using cut command:

[user@xxx rails]$svn st | grep ? | tr -s ' ' | cut -d ' ' -f 2
app/controllers/application.rb
config/database.yml

Step 5: Finally, passing these file paths as standard input to svn add command:

[user@xxx rails]$svn st | grep ? | tr -s ' ' | cut -d ' ' -f 2 | xargs svn add
A app/controllers/application.rb
A config/database.yml

 

How to use “svn add” recursively in Linux shell?的更多相关文章

  1. SVN的Windows和Linux客户端操作详解

    SVN的Windows和Linux客户端操作详解 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 一.Windows客户端操作 1.安装SVN客户端 a>.去官网下载svn软件 ...

  2. svn add 添加到版本库

    转 svn add-添加到版本库 常用操作1.添加一个文件到工作拷贝:$ svn add foo.c 2.当添加一个目录,svn add缺省的行为方式是递归的:$ svn add testdir 3. ...

  3. 苹果IOS系统SVN命令 同样适用于linux系统

    1.将文件checkout到本地目录svn checkout path(path是服务器上的目录)例如:svn checkout svn://192.168.1.1/pro/domain简写:svn ...

  4. 一次向svn中增加所有新增文件 svn add all new files

    svn st | grep '^\?' | tr '^\?' ' ' | sed 's/[ ]*//' | sed 's/[ ]/\\ /g' | xargs svn add

  5. svn add后的数据如何取消-svn revert??--zz

    svn add后的数据如何取消-svn revert?? 有时候你发现svn add后,这个提交的数据又不需要了.这时候需要有svn revert来处理了. 原文链接:http://hi.baidu. ...

  6. Linux(以RHEL7为例)下添加工作区的方法|| The Way To Add Workspace On Linux

    Linux(以RHEL7为例)下添加工作区的方法 The Way To Add Workspace On Linux 作者:钟凤山(子敬叔叔) 编写时间:2017年5月11日星期四 需求:有时候在使用 ...

  7. svn add @2x image 文件

    svn add `svn status . | grep "^?" | awk '{print $2"@"}'`

  8. svn add --no-ignore

    提交新代码时:svn add --no-ignore  /dir   不加的话可能会漏提交某些依赖或文件. Svn st -q --no-ignore. 提交时不需要加

  9. svn add xxx.txt 提示A (bin) xxx.txt

    [root@NGINX-APACHE-SVN iptables]# svn ci -m "add iptables.txt" Adding (bin) iptables/iptab ...

随机推荐

  1. 基于Jquery-ui的自动补全

    1.添加CSS和JS引用 <script type="text/javascript" src="javascript/jquery-1.7.min.js" ...

  2. git使用2

    初始化配置 #配置使用git仓库的人员姓名 git config --global user.name "Your Name Comes Here" #配置使用git仓库的人员em ...

  3. [转]Caffe在Linux下的安装,编译,实验

    Caffe在Linux下的安装,编译,实验  原文地址:http://www.cnblogs.com/evansyang/p/6150118.html 第一部分:Caffe 简介 caffe是有伯克利 ...

  4. spring随想

    //不定时持续更新 1.拦截器通过配置文件,在某方法前后添加一些处理,如权限判断等,减少了改方法需要处理的事,是其更专注,由配置文件来设定责任链,更灵活,而且责任链能够复用(一方面是这样能由sprin ...

  5. C# Winform程序获取外网IP地址

    string strUrl = "http://www.ip138.com/ip2city.asp"; //获得IP的网址了 Uri uri = new Uri(strUrl); ...

  6. 【kd-tree】bzoj4154 [Ipsc2015]Generating Synergy

    区间修改的kd-tree,打标记,下传. 每次询问的时候,从询问点向上找到根,然后依次下传下来,再回答询问. #include<cstdio> #include<algorithm& ...

  7. [f]JQ cookie插件

    jQuery.cookie = function(name, value, options) { if (typeof value != 'undefined') { options = option ...

  8. C2第六次作业解题报告

    看过题解后如果觉得还算有用,请帮忙加点我所在团队博客访问量 http://www.cnblogs.com/newbe/ http://www.cnblogs.com/newbe/p/4069834.h ...

  9. Linux sort 多字段分组排序

    常用参数: -t: 指定分隔符 -k: 指定域 -u: 去除重复行 -n: 以数值排序 -r: 降序排序 (sort默认的排序方式是升序) -o: 结果重定向输出到文件 1.源文件: # cat hh ...

  10. poj 2240 Arbitrage

    Time Limit: 1000 MS Memory Limit: 65536 KB 64-bit integer IO format: %I64d , %I64u   Java class name ...