Git Product home page Git Product logo

sys-tools-bash's Introduction

file_search_replace

To find and replace string patterns within specified files in a folder list provided

  • This script works on the folders as specified in the folders_data.txt

Script usage Input flags

  • [-f] Regex pattern for string to find
  • [-r] Replace pattern for found string
  • [-p] To only print the files found by the [-f] regex pattern, without replacing found string with the [-r] string specified
  • [-b] To specify the base directory to run this script on; default would be: /mnt/c/Users/gohja/Desktop
  • [-s] To specify the sub directory; default would be:
  • [-h] prints help message
user@linux:sys-tools-bash/file_search_replace$ ./fsr.sh -<flags>

To take note:

  • For the [-b] flag, single or double quotes should be omitted when using absolute path, to prevent Bash from reading it as a string literal

For example:

user@linux:sys-tools-bash/file_search_replace$ ls ~/example_folder
... results
... 
...

user@linux:sys-tools-bash/file_search_replace$ ./fsr.sh -<other_relevant_flags> -b '~/example_folder'
failed to open file ...: No such file or directory

user@linux:sys-tools-bash/file_search_replace$ ./fsr.sh -<other_relevant_flags> -b ~/example_folder
... desired results
...
...

sys-tools-bash's People

Contributors

jarrettgohh 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.