Skip to content

Search and Replace all the files underneath a given directory tree with a given mapping table

License

Notifications You must be signed in to change notification settings

blackappsolutions/multi-replacer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Multi Replacer

Search and Replace all the files underneath a given directory tree with a given mapping table.

The table items must be separated with

[..] runs of consecutive whitespace [..]

as we use here the default of python's str.split-method.

In the test folder you can find a sample of a mapping table:

# Taken from https://documentation.coremedia.com/cmcc-10/artifacts/2010/webhelp/deployment-en/content/contentServerRenamedProperties.html
sql.store.sgmlcache.size 	sql.store.sgml-cache-size-bytes
sql.store.sgmlcache.sizeBytes 	sql.store.sgml-cache-size-bytes

As you can see, also comments are possible starting with a hash ('#').

Feel free to adapt this to your needs. The relevant line of code is currently here.

Usage

./multi-replacer.py FILE_EXTENSION FOLDER MAPPING_FILE

Test

You can use (or play around) with the given infrastructure in the test-folder.

./multi-replacer.py properties test test/mapping.txt

About

Search and Replace all the files underneath a given directory tree with a given mapping table

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages