Find and replace multiline strings
All you need is Docker
- 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 -->
- 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
- Run the application
$ docker run --rm -v ${PWD}/:/app unfor19/replacer -sf /app/incoming.txt -df /app/README.md
- 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
Created and maintained by Meir Gabay
This project is licensed under the MIT License - see the LICENSE file for details