diff --git a/tren.rst b/tren.rst index 02b94ea..455bfb3 100644 --- a/tren.rst +++ b/tren.rst @@ -281,7 +281,7 @@ Both of these refer to the last instance of old string ``foo`` (found at ``foo4`` in our example name). - Sometimes, you'd like to replae a whole *range* of + Sometimes, you'd like to replace a whole *range* of instances. An "instance range" is specified using the ``:`` separator in the form:: @@ -376,7 +376,7 @@ (*Default*: .backup) - If you choose to force renaming if files when the new + If you choose to force file renaming when the new name already exists (``-f``), **tren** simply renames the existing file or directory by appending a suffix to it. By default, this suffix is ``.backup``, but you @@ -445,7 +445,7 @@ The following sections are designed for the new- or occasional **tren** user. They begin with the simplest of **tren** operations -and incrementally build more- and more complex examples, eventually +and incrementally build more and more complex examples, eventually describing all of **tren**'s capabilities. @@ -806,7 +806,7 @@ tren.py -r foo=bar -r foo=baz foo1-foo2-foo3.foo4 Produces ... wait a second ... why on earth are there two renaming -requests with idential ``old`` strings on the same command line? +requests with identical ``old`` strings on the same command line? Shouldn't this produce a final name of ``baz1-foo2-foo3.foo4``? Nope. After the leftmost renaming request has been processed, @@ -883,8 +883,9 @@ the file attribute- or sequence renaming tokens (discussed later in this document). - 4) Build a table containg each renaming request storing the current - state of every program option at that point on the command line. + 4) Build a table containing each renaming request storing the + current state of every program option at that point on the + command line. This allows **tren** to apply options differently to different renaming requests on the same command line. This came in handy @@ -1169,12 +1170,12 @@ Changing The Renaming Separator & Escape Characters =================================================== -There may be times when the default renaming separator (``=``) -and/or escape character (``\``) make it clumsy to construct a -renaming request. This can happen if, say, either the old- or new -string in a literal renaming needs to use the ``=`` symbol many -times. Another case where this may be helpful is when constructing -complex regular expressions than need to make use of these characters. +There may be times when the default renaming separator (``=``) and/or +escape character (``\``) make it clumsy to construct a renaming +request. This can happen if, say, either the old- or new string in a +literal renaming needs to use the ``=`` symbol many times. Another +case where this may be helpful is when constructing complex regular +expressions that need to make use of these characters. The ``-R`` and ``-P`` options can be used to change the character used for renaming separator and escape character respectively. You @@ -1287,9 +1288,10 @@ 032344.jpeg # Sid's camera, taken 1-3-2010 at 4pm It would be nice to get these in order somehow. We can, by combining -*attribute* renaming tokens (that know thing about the file being renamed) -and *sequence* renaming tokens (that know how to order all the files -being renamed by some key like date, length, who owns it, and so on):: +*attribute* renaming tokens (that know things about the file being +renamed) and *sequence* renaming tokens (that know how to order all +the files being renamed by some key like date, length, who owns it, +and so on):: tren.py -r =/MYEAR//MMON//MDAY/-MyVacation-/+MDATE::0001/.jpeg *.jp* @@ -1389,7 +1391,7 @@ As we saw in earlier sections, **tren** command line option and file name interaction can be tricky. It can depend on order and on whether -the various renaming request "collide" with each other as a new file +the various renaming requests "collide" with each other as a new file name is computed. A similar potential collision exists between renaming tokens and renaming requests. Recall from `More About Command Line Pitfalls`_ that renaming tokens are resolved *before* a @@ -1426,7 +1428,7 @@ fit in one of three categories: - An attribute of the file or directory being renamed - - An attribute of the underling operating system environment + - An attribute of the underlying operating system environment - A sequence that reflects some ordering principle Renaming tokens are delimited by ``/`` characters, in the form:: @@ -1465,7 +1467,7 @@ original_name-YYYY-length # Example: myfile-2010-4099 In short, attributes are just string substitutions wherein the string -tells you someting about the file or system on which you're working. +tells you something about the file or system on which you're working. "Sequences", on the other hand, are just *numbers that represent some ordering principle*. Say you use the sequence renaming token ordered @@ -1521,7 +1523,7 @@ - The *original name* of the file before any renaming took place - The date/time it was last *accessed* - The date/time it was last *modified* - - The date/time it's directory entry (inode) was last *modified* + - The date/time its directory entry (inode) was last *modified* - The *inode number* for the file - The *device number* where the directory entry (inode) lives - The *numeric group ID* the file belongs to @@ -1646,9 +1648,9 @@ ``/NLINK/ Returns Number Of Links To File- Or Directory Being Renamed`` Most operating systems allow a single file to have - multiple names. These names are "linked" to the an - instance of the file. This replacement token is a - numeric string representing the number of such links. + multiple names. These names are "linked" to the instance + of the file. This replacement token is a numeric string + representing the number of such links. ``/SIZE/ Returns File- Or Directory's Length In Bytes`` @@ -1785,7 +1787,7 @@ file names. Spaces, however, are preserved. For instance, you might want to prepend the name of the - system to all you shell scripts:: + system to all your shell scripts:: tren.py -r ='/`uname -n`/'-/FNAME/ *.sh # Unix shells tren.py -r ="/`uname -n`/"-/FNAME/ *.sh # Windows shells @@ -2533,7 +2535,7 @@ ``/+-USER:Alphabet:FormatField/ Sequence based on user name`` -This returns a sequence ordered by the name of the user that own +This returns a sequence ordered by the name of the user that owns the file- or directory. This is only supported on Windows if the ``win32all`` Python extensions @@ -2620,9 +2622,9 @@ tren.py -r '/$LOGNAME/'-= * - Generally, if you can isolate the newly introduced text of the - renaming and place use it as the ``old`` string in a renaming - request, this will work. + Generally, if you can isolate the text introduced by the previous + renaming operation, and use it as the ``old`` string in another + renaming request, this will work. ODDS AND ENDS @@ -2693,7 +2695,7 @@ **cygwin** team upgrades to 2.6.x, **tren** is expected to work there as well. -This program is **EXPERIMENTAL** (see the license). This means it's +This program is **EXPERIMENTAL** (see the license). This means its had some testing but is certainly not guaranteed to be perfect. As of this writing, it has been run on FreeBSD, Linux, Windows XP, and Mac OS X. It has not, however, been run on 64-bit versions of those OSs. @@ -2741,7 +2743,7 @@ :: - $Id: tren.rst,v 1.181 2010/04/07 23:00:56 tundra Exp $ + $Id: tren.rst,v 1.182 2010/04/23 16:13:45 tundra Exp $ You can find the latest version of this program at: