| |
---|
| | second example, removing the ``-T`` targeting gives us:: |
---|
| | |
---|
| | tren.py -i: -re=E abcdef.text # -> abcdEf.tExt |
---|
| | |
---|
| | So, ``-T`` lets you specify what substring of the full name |
---|
| | is a candidate for renaming. All other renaming operations |
---|
| | like ``-i``, ``-r``, and so on operate *only upon the substring |
---|
| | specified by* ``-T``. |
---|
| | |
---|
| | If you specify multiple renaming operations on the command line, |
---|
| | any ``-T`` targeting will remain in effect *for each renaming request*. |
---|
| | So, ``-T`` lets you specify what substring of the full name is a |
---|
| | candidate for renaming. All other renaming operations like ``-i``, |
---|
| | ``-r``, and so on operate *only upon the substring specified by* |
---|
| | ``-T``. |
---|
| | |
---|
| | If you specify multiple renaming operations on the command line, any |
---|
| | ``-T`` targeting will remain in effect *for each renaming request*. |
---|
| | For instance:: |
---|
| | |
---|
| | tren.py -T -1 -r=OO -r=x foo |
---|
| | |
---|
| |
---|
| | |
---|
| | foo -> foOO |
---|
| | foOO -> foOx # Final name |
---|
| | |
---|
| | In other words, each incremental renaming request honors the |
---|
| | current state of the ``-T`` option. To turn off targeted |
---|
| | renaming - that is, make the whole file name the target again - |
---|
| | simply include ``-T :`` on the command line. All renaming requests |
---|
| | to the right of it will then target the whole name:: |
---|
| | In other words, each incremental renaming request honors the current |
---|
| | state of the ``-T`` option. To turn off targeted renaming - that is, |
---|
| | make the whole file name the target again - simply include ``-T :`` on |
---|
| | the command line. All renaming requests to the right of it will then |
---|
| | target the whole name:: |
---|
| | |
---|
| | tren.py -T -1 -r=OO -T: -rO=x foo # Yields: foxO |
---|
| | |
---|
| | |
---|
| |
---|
| | t -1 |
---|
| | |
---|
| | |
---|
| | Notice that left-relative indexes are positive numbers beginning with |
---|
| | 0, but right-relative indexes are are negative numbers beginning at -1. |
---|
| | |
---|
| | So, what's a slice? A slice is a way of specifying *a range of one or more values*. |
---|
| | In the case of the ``-T`` option, "values" means "positions in the name string |
---|
| | targeted for renaming." In the case of the ``-i`` option, "values" means |
---|
| | *which instances of a given string should be renamed*. |
---|
| | |
---|
| | In our example above, the ``bcd`` portion of the name could be |
---|
| | defined several different ways:: |
---|
| | 0, but right-relative indexes are are negative numbers beginning at |
---|
| | -1. |
---|
| | |
---|
| | So, what's a slice? A slice is a way of specifying *a range of one or |
---|
| | more values*. In the case of the ``-T`` option, "values" means |
---|
| | "positions in the name string targeted for renaming." In the case of |
---|
| | the ``-i`` option, "values" means *which instances of a given string |
---|
| | should be renamed*. |
---|
| | |
---|
| | In our example above, the ``bcd`` portion of the name could be defined |
---|
| | several different ways:: |
---|
| | |
---|
| | 1:4 |
---|
| | -9:-6 |
---|
| | |
---|
| |
---|
| | manner, whereas the ``A=b`` will be done only on literal instances of |
---|
| | upper case ``A`` in the target file names. |
---|
| | |
---|
| | |
---|
| | Forcing Case Transformation |
---|
| | =========================== |
---|
| | Case Transformation |
---|
| | =================== |
---|
| | |
---|
| | Sometimes you want to actually force the case of the characters |
---|
| | in a filename to change. You do this with the ``-e`` option. |
---|
| | This option takes one of several arguments:: |
---|
| |
---|
| | is ignored. That's because the ``-e`` option isn't based on replacing |
---|
| | an "old" string like the ``-r`` renaming option, but rather operates |
---|
| | on the file name as a whole. |
---|
| | |
---|
| | You can, however, limit what portion of the filename is "targeted" |
---|
| | for case conversion via the ``-T`` option:: |
---|
| | |
---|
| | tren.py -T 4:6 -et fee_fi_fo # -> fee_Fi_fo |
---|
| | |
---|
| | |
---|
| | As with all renaming requests, ``-e`` is just another *incremental* |
---|
| | renaming operation on the command line:: |
---|
| | |
---|
| | |
---|
| | tren.py -rfi=fud -et fee_fi_fo # -> fee_fud_fo -> Fee_Fud_Fo |
---|
| | |
---|
| | You can actually watch these increments happen by using the ``-d`` |
---|
| | command line option. |
---|
| | You can actually see these incremental transformations by specifying |
---|
| | the ``-d`` option on the command line. |
---|
| | |
---|
| | |
---|
| | The Strange Case Of Mac OS X And Windows |
---|
| | ======================================== |
---|
| |
---|
| | ----------------------------- |
---|
| | |
---|
| | :: |
---|
| | |
---|
| | $Id: tren.rst,v 1.197 2010/11/16 20:49:40 tundra Exp $ |
---|
| | $Id: tren.rst,v 1.198 2010/11/16 20:59:31 tundra Exp $ |
---|
| | |
---|
| | You can find the latest version of this program at: |
---|
| | |
---|
| | http://www.tundraware.com/Software/tren |
---|
| |
---|
| | |