Skip to content

About

Fast multithreaded CLI tool that replaces text across files under a directory

Topics

Resources

Stars

3 stars

Watchers

1 watching

Forks

Repository files navigation

fastreplace

A fast multithreaded CLI tool that replaces text across files under a directory.

English | Chinese


Overview

fastreplace walks a path (recursively), optionally filters by file suffix, and replaces all occurrences of a string with another — using a bounded worker pool for speed.

Install

Download a prebuilt binary from the Releases page, or build from source:

git clone https://github.com/esrrhs/fastreplace.git
cd fastreplace
go build -o fastreplace .

Docker:

docker pull esrrhs/fastreplace

Usage

Replace aaa with bbb in every .txt file under the current directory:

./fastreplace -path ./ -file .txt -from aaa -to bbb

Show version:

./fastreplace -version

More flags:

Usage of ./fastreplace:
  -file string
        file format (suffix filter, e.g. .txt)
  -from string
        old string
  -path string
        replace path (default "./")
  -thread int
        replace thread (default 32)
  -to string
        new string
  -v    show info
  -version
        show version

Build release packages

./pack.sh

Cross-platform archives are written to pack/. The Release workflow watches version.go: when its version string changes on master (and the tag does not exist yet), CI runs ./pack.sh and publishes a GitHub Release.

License

MIT — see LICENSE.

About

Fast multithreaded CLI tool that replaces text across files under a directory

Topics

Resources

Stars

3 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages