command
module
Version:
v0.0.0-...-fe69355
Opens a new window with list of versions in this module.
Published: Nov 27, 2016
License: Apache-2.0
Opens a new window with license information.
Imports: 4
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
README
¶
find2
用golang写的查找/替换文件内容的工具。
特性
- 支持按内容搜索文件
- 支持替换文件内容
- 支持将匹配到的文件保存到指定文件夹
- 支持将匹配到的文件进行zip压缩(保存为compress.zip)
- 匹配规则统一使用正则表达式
用法
执行以下命令
go build
# 查看用法
find2 -h
example:
./find2 -findPath ./www -fileRule \.php$ -contentRule "a\.user|a\.profile" -savePath ./found -compress true
本例中,压缩后的文件保存在"./found/compress.zip"。
用参数组合实现特定功能
- 如果不设置
-contentRule
,并且设置-compress
为true
,则会将符合规则的文件添加到zip压缩包。
- 如果不设置
-contentRule
,并且设置-compress
为false
或者不设置,则会将符合规则的文件复制到-savePath
指定的目录中,
如果不指定-savePath
的值则复制到当前目录中。
- 如果设置了
-contentRule
但没有设置-savePath
时,则会直接修改原文件并将原始文件保存一份备份。
可以用./find2 -restore 20161006093020
还原指定时间的备份。
Documentation
¶
There is no documentation for this package.
Source Files
¶
Directories
¶
Click to show internal directories.
Click to hide internal directories.