/fr

find and replace

Primary LanguageShell

FR - find and replace

GitHub release (latest by date) GitHub Workflow Status GitHub Repo stars GitHub repo size

    __________
   / ____/ __ \
  / /_  / /_/ /
 / __/ / _, _/
/_/   /_/ |_|
fr - Find and Replace in files
Version: 0.1.0

Features

  • Find and replace text in files
  • Find and replace text in files with regex recursively
  • Find and replace text in files with specific extensions

Upcoming features

  • Ability to target by filename
  • Ability to exclude directories
  • Ability to exclude files with specific extensions/names
  • Ability to install with package managers
  • Use rust tools if available
  • Ability to use multiple find and replace patterns

Installation

git clone https://github.com/elliot40404/fr
cd fr
chmod +x install.sh
./install.sh

or

sudo curl -o- https://raw.githubusercontent.com/elliot40404/fr/master/install.sh | bash
sudo wget -qO- https://raw.githubusercontent.com/elliot40404/fr/master/install.sh | bash

Usage

fr [directory]* [pattern]* [new_value]* [extension] [deep]

* = Required argument

Argument Description Required Default
first argument [directory] The directory to search in yes none
second argument [pattern] The pattern to search for yes none
third argument [new_value] The new value to replace the pattern with yes none
-e, --extension files with extension to search for no All files
-d, --deep Whether to search in subdirectories no false
-h, --help Print help menu

Examples

Replace foo with bar in all files in the current directory:

fr . "foo" "bar"

Replace foo with bar in all files in the test directory:

fr test/ "foo" "bar"

Replace foo with bar in all javascript files in the test directory:

fr test/ "foo" "bar" -e js

Replace foo with bar in all files in the test directory and its subdirectories:

fr test/ "foo" "bar" -d

Replace foo with bar in all javascript files in the test directory and its subdirectories:

fr test/ "foo" "bar" -e js -d

License

MIT