Skip to content

unfor19/replacer

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 

replacer

testing

Find and replace multiline strings

Requirements

All you need is Docker

Getting Started

  1. Insert a start tag and stop tag to a text file, for example
<!-- replacer_start -->

<div>This is the text block that will be replaced</div>
<div>Let's make it work!</div>

<!-- replacer_end -->
  1. Prepare a file with the text that you want to inject
$ echo -e '<div>This is the incoming text block</div>\n<div>It worked!</div>' > incoming.txt
  1. Run the application
$ docker run --rm -v ${PWD}/:/app unfor19/replacer -sf /app/incoming.txt -df /app/README.md
  1. That's it, your text has been replaced! To see more options
$ docker run --rm -v ${PWD}/:/app unfor19/replacer --help

Usage: bash main.sh -sf incoming.txt -df README.md

	--dst_file_path     |  -df  [REQUIRED]                 Full path to destination file
	--src_file_path     |  -sf  [replacer_null]            Full path to source file that will be injected
	--src_text          |  -st  [replacer_null]            Text of the source to inject
	--start_value       |  -sv  [<!-- replacer_start -->]  From where to start
	--end_value         |  -ev  [<!-- replacer_end -->]    Where to stop
	--create_backup     |  -cb  [true]                     Create a backup file
	--backup_file_path  |  -bp  [./]                       Full path to backup file

NOTE: the code block above ☝️ was automatically generated with replacer! See the raw version of this README.md file and update_readme.sh

Authors

Created and maintained by Meir Gabay

License

This project is licensed under the MIT License - see the LICENSE file for details