Coder Social home page Coder Social logo

wordrename's Introduction

This tool helps to automate the creation of files from templates by replacing some words with others.

Prerequisites

Python3 should bre installed for this tool. Click here if not installed. OR on linux

sudo apt update
sudo apt install python3-pip
pip3 --version

Installation

First clone the tools repo

git clone https://github.com/matovu-farid/tools.git
ln -s $PWD/tools/rename/wordrename  /usr/bin   

Usage

wordrename -[i <input>| -d <directory>] -o <output> -r <replaced>  -w <with> 

Replace words with those provided

Options:
-i, --input        Input filename
-d, --directory    Input directory
-o, --output       Output filename
-r, --replaced     Word to replace 
-w, --with         Word replacing the other word
-c, --clean        Removes the input file

Example

Assuming you have a file called file.txt and you want to replace all words foo with bar. Running the command below will replace all words including uppercase, title case and pluralized words

Single file

wordrename -i file.txt -r foo -w bar

Multiple files

wordrename -i file.txt,file2.txt -r foo -w bar

Multiple replaced words

Note: The number of replaced words should match the number of words that are replacing them

wordrename -i file.txt -r foo,foo2 -w bar,bar2

Specifying input directory

Assuming you have a folder called 'directory_name' that has file whose words you would want to copy and replace all words foo with bar.

wordrename -d directory_name -r foo -w bar

wordrename's People

Contributors

matovu-farid avatar

Stargazers

 avatar  avatar  avatar

Watchers

 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.