Skip to content

kaosf/text-replacer-with-file

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Text Replacer with File

Version 0.2.1

Installation

Copy text-replacer-with-file to a directory that is in your PATH.

Usage

text-replacer-with-file TARGET_FILE REPLACED_TEXT INSERTED_FILE

Examples

Create a.txt, b.txt and c.txt as;

This is a text file for tests. abc will be replaced.
Duplicated bcd will be replaced.
This bcd will be also replaced.
c/d/e dosen't exist.
"This text was in b.txt"
"Multi lines in c.txt
are inserted!"

Example 1

text-replacer-with-file a.txt abc b.txt

a.txt will be;

This is a text file for tests. "This text was in b.txt" will be replaced.
Duplicated bcd will be replaced.
This bcd will be also replaced.
c/d/e dosen't exist.

Example 2

text-replacer-with-file a.txt abc c.txt

a.txt will be;

This is a text file for tests. "Multi lines in c.txt
are inserted!" will be replaced.
Duplicated bcd will be replaced.
This bcd will be also replaced.
c/d/e dosen't exist.

Example 3

text-replacer-with-file a.txt bcd b.txt

a.txt will be;

This is a text file for tests. abc will be replaced.
Duplicated "This text was in b.txt" will be replaced.
This "This text was in b.txt" will be also replaced.
c/d/e dosen't exist.

Example 4

text-replacer-with-file a.txt cde b.txt

a.txt will not change because cde doesn't exist in a.txt.

Memo

Should this behavior return not 0? Behave as an error?

Test

./test/run.sh

About shUnit2

shUnit2 is a xUnit for ShellScript.

Download it from here (I've downloaded shunit2-2.1.6.tgz) and extract it. Then, copy src/shunit2 into test directory.

An official documentation is here. Refer it to know how to use shUnit2 more.

References

License

MIT

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •  

Languages