GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - svandriel/file-find-replace-cli: Command line tool for replacing text in files, using a JSON file containining matches and replacements

BranchesTags
Open more actions menu

Latest commit

 

History

63 Commits
63 Commits

Folders and files

NameName
Last commit message
Last commit date
src
src
 
 
testdata
testdata
 
 
.editorconfig
.editorconfig
 
 
.eslintignore
.eslintignore
 
 
.eslintrc.json
.eslintrc.json
 
 
.gitignore
.gitignore
 
 
.npmignore
.npmignore
 
 
.prettierignore
.prettierignore
 
 
.prettierrc.json
.prettierrc.json
 
 
.travis.yml
.travis.yml
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
jest.config.js
jest.config.js
 
 
package.json
package.json
 
 
test.sh
test.sh
 
 
tsconfig.json
tsconfig.json
 
 
yarn.lock
yarn.lock
 
 

Repository files navigation

Build status

file-find-replace-cli

Command-line tool to find and replace text in files.

Installation

npm i -g file-find-replace-cli

Usage

# Replace within a single file
find-replace replace.json -f 'data/users.txt'

# Or within multiple files (uses globs)
find-replace replace.json -f 'data/**/*.txt' -f 'src/**/*.ts'

Syntax

$ file-replace -h

Usage: file-replace <replacementFile> [options]

Command line tool for replacing text in files, using a JSON file containing matches and replacements.
The JSON file must contain an object (or array of objects), each containing a 'find' and 'replace' entry

Arguments:
  replacementFile       The JSON file containing matches and replacements

Options:
  -V, --version         output the version number
  -f, --file [file...]  Path or glob to a file to replace. Can be used
                        multiple times.
  -v, --verbose         Turns on verbose mode
  -h, --help            display help for command

Replacement file

replace.json contains the replacement info:

[
  {
    "find": "foo",
    "replace": "bar",
    "ignoreCase": true // Optional
  },
  {
    "find": "unicorn",
    "replace": "🦄"
  }
]

The file must contain a single replacement object, or an array of replacements.

{
  "find": "<something to find>",
  "replace": "<will be replaced with>",
  "ignoreCase": false, // optional; false by default
  "wholeWord": false // optional; false by default
}

About

Command line tool for replacing text in files, using a JSON file containining matches and replacements

Topics

clifilefindreplace

Resources

Readme
MIT license
Activity

Stars

2 stars

Watchers

1 watching

Forks

1 fork
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.