惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

V
Visual Studio Blog
J
Java Code Geeks
H
Hackread – Cybersecurity News, Data Breaches, AI and More
D
Docker
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
博客园 - 聂微东
MyScale Blog
MyScale Blog
H
Help Net Security
Last Week in AI
Last Week in AI
T
The Blog of Author Tim Ferriss
M
MIT News - Artificial intelligence
大猫的无限游戏
大猫的无限游戏
酷 壳 – CoolShell
酷 壳 – CoolShell
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
P
Proofpoint News Feed
博客园 - 叶小钗
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Y
Y Combinator Blog
Recent Announcements
Recent Announcements
F
Fortinet All Blogs
Martin Fowler
Martin Fowler
Microsoft Security Blog
Microsoft Security Blog
T
Tailwind CSS Blog
aimingoo的专栏
aimingoo的专栏

博客园 - 孤剑

谈谈微信支付曝出的漏洞 阿里云ACE深圳同城会 开始报名 CSS 埋点统计 Java反序列化漏洞执行命令回显实现及Exploit下载 在线测试 ssl 安全性 检测一下你的专业指数:2015年十大测试工具你认识几个? nginx用户认证配置( Basic HTTP authentication) FTP基础知识 FTP port(主动模式) pasv(被动模式) 及如何映射FTP 虚拟机评估——如何确定一个CPU核上部署的虚拟机数量? iptables防火墙原理详解 linux平台下防火墙iptables原理(转) 通过rinetd实现端口转发来访问内网的服务 nmap端口状态解析 每天一个linux命令(53):route命令 49 款开源办公软件 如何关闭Linux里边的selinux ? NMAP 基础教程 Linux下批量修改文件名(rename) 将 LDAP 目录用于 Samba 认证
How to use “svn add” recursively in Linux shell?
孤剑 · 2016-01-03 · via 博客园 - 孤剑

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