File alteration bot for programmatically altering large amount of files with Regular Expressions.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

page-changer Build Status

File alteration bot for programmatically altering large amount of files with Regular Expressions

page-changer can be used to search through text based files and make change to the text by adding, deleting, changing or a combination of all three.

This is done using a config file to tell page-changer what to alter in what file type.


page-changer is a single file script so it can just be downloaded on its own.

It does have a dependancy on PyYAML, so this needs to be installed on the system along with Python.


page-changer uses a YAML config file that you specify as a command line argument to know what files to change.

The format of the config file is:

  - name: <name of the set>
    criteria: <string or reg ex that must be present in the file for it to be processed>
    - <list of filenames (without paths) that match the criteria but you want to ignore explicitly>
        - <reg ex to remove from line>
        - find: <text to that will be replaced use %rep%>
          replace: <text to replace>
  - name: ... <put n or more parser sets, to parse different file types, or alterations required>

An example file would be:

- name: html
  criteria: findme
  - dontchangeme.txt
  mask: 'Search.html'
  - <head>
  - <html xmlns="">
  - </head>
  - <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "">
  - </html>
  - </body>
  - <body>
  - find: colou*r
    replace: something else

To run the config over a set of files use the command line tool: config.yaml /path/to/files/to/search

Here are the command line options and arguments:

usage: [-h] [--recursive] C D

Mass edit text files.

positional arguments:
  C                Config file to use.
  D                Directory to search for files to change.

optional arguments:
  -h, --help       show this help message and exit
  --recursive, -r  Recursivly search for files inside dir.