Coder Social home page Coder Social logo

find2's Introduction

find2

用golang写的查找/替换文件内容的工具。

特性

  1. 支持按内容搜索文件
  2. 支持替换文件内容
  3. 支持将匹配到的文件保存到指定文件夹
  4. 支持将匹配到的文件进行zip压缩(保存为compress.zip)
  5. 匹配规则统一使用正则表达式

用法

执行以下命令

go build

# 查看用法
find2 -h

example:

./find2 -findPath ./www -fileRule \.php$ -contentRule "a\.user|a\.profile" -savePath ./found -compress true

本例中,压缩后的文件保存在"./found/compress.zip"。

用参数组合实现特定功能

  1. 如果不设置-contentRule,并且设置-compresstrue,则会将符合规则的文件添加到zip压缩包。
  2. 如果不设置-contentRule,并且设置-compressfalse或者不设置,则会将符合规则的文件复制到-savePath指定的目录中, 如果不指定-savePath的值则复制到当前目录中。
  3. 如果设置了-contentRule但没有设置-savePath时,则会直接修改原文件并将原始文件保存一份备份。 可以用./find2 -restore 20161006093020还原指定时间的备份。

find2's People

Contributors

admpub avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.