diff --git a/tren.rst b/tren.rst index 15f5507..421ec73 100644 --- a/tren.rst +++ b/tren.rst @@ -265,6 +265,9 @@ This option's behavior is modified by the ``-b``, ``-c``, ``-e``, ``g``, ``l``, and ``x`` options. + If you need to use the ``=`` symbol *within* either + the old or new string, simply escape it: ``\=`` + -t Test mode, don't rename, just show what the program *would* do (ignores -q). @@ -312,7 +315,14 @@ sXs-3.txt **tren** only accepts Python style regular expressions. Anything - else will cause an error message to be displayed. + else will cause an error message to be displayed. + + Because Python regular expressions can make use of the ``=`` + symbol, you need a way to distinguish between an ``=`` used in a + regular exression and the same symbol used to separate the old + and new operands for the ``-r`` option. Where this symbol needs to + appear in a regular expression, it has to be escaped like this: + ``\=``. TEMPLATE CONSTRUCTION @@ -409,56 +419,63 @@ EXAMPLES -------- -Here are some common examples of **tren** in action: +Here are some common examples of **tren** in action - the resulting +file name(s) shown to the right as a comment. Study each example +carefully. Small subtleties are introduced in various +adjacent examples to illustrate diffent features of **tren**: Simple rename:: - tren.py + tren.py -r old=New fold.txt log.old # fNew.txt log.New Change file "name":: - tren.py + tren.py -b -r old=New fold.txt log.old # fNew.txt log.old Change file "extension":: - tren.py + tren.py -e -r old=New fold.txt log.old # fold.txt log.New Rename all instances of a given string:: - tren.py + tren.py -g -r bin=Bin binary_bin.binbin # Binary_Bin.BinBin Rename, ignoring case:: - tren.py + tren.py -c -r bin=BIN Binary_bIN.txt # BINary_bIN.txt Rename multiple strings at once:: - tren.py + tren.py -r log:txt -r New:old New.log # old.txt Rename using regular expressions:: - tren.py + tren.py -x -r a+=a Saaaaaaaally.doc # Sally.doc + + Rename a file containing the ``=`` symbol:: + + tren.py -r a\=b=c\=d a=b.txt # c=d.txt Use template:: - tren.py + tren.py -T /I/ file.1 # 2010-01-12 Use template to change file "name":: - tren.py + tren.py -b -T /I/ file.1 file.2 # 2010-01-12.1 2010-01-12.2 Use template to change file "extension":: - tren.py + tren.py -e -T /D/ file.1 # file.20100112 Append template text:: - tren.py + tren.py -a -T ./D/ file.1 # file.1.20100112 Prepend template text:: - tren.py + tren.py -p -T /D/- file.1 # 20100112-file.1 Get help:: @@ -507,7 +524,7 @@ :: - $Id: tren.rst,v 1.116 2010/01/16 17:06:00 tundra Exp $ + $Id: tren.rst,v 1.117 2010/01/16 19:58:19 tundra Exp $ You can find the latest version of this program at: