"Fossies" - the Fresh Open Source Software Archive

Member "tmv-1.1.3/README" (19 Jul 2005, 5416 Bytes) of package /linux/privat/old/tmv-1.1.3.tar.gz:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 
    2 tmv
    3 http://tmv.sourceforge.net
    4 written by Gene Pavlovsky <heilong@bluebottle.com>
    5 
    6 1. Introduction
    7 
    8 Renames files/directories according to sed script(s). Optionally,
    9 converts pathnames to upper/lower-case, from/to the specified
   10 character set, or even pipes them through arbitrary command(s).
   11 
   12 2. Documentation
   13 
   14 The 'tmv' shell script applies a number of transformations to a list
   15 of pathnames (files/directories). The list of pathnames is specified
   16 on a command line. Pathnames will also be read from standard input
   17 in case none were found on command line, or '-' was specified on
   18 command line. Transformations are commands that read their input,
   19 process it, and output the results. This architecture allows for
   20 several built-in transformations and a multitude of external ones,
   21 by specifying arbitrary command(s) to process the pathnames.
   22 Please note that only the last slash-delimited portion of the name
   23 is transformed (e.g. 'tmv -l /A/B' will move '/A/B' to '/A/b').
   24 
   25 Usage: tmv [options] pathname [pathname]*
   26 
   27 2.1. Transformation using sed
   28 
   29 This transformation, the most flexible of the built-in ones,
   30 uses sed to perform a sed script on the pathnames.
   31 
   32 Options:
   33 
   34   -e SCRIPT, --expression=SCRIPT
   35         add the SCRIPT to the sed script
   36   -f FILE, --file=FILE
   37         add the contents of FILE to the sed script
   38   -r, --regexp-extended
   39         use extended regular expressions in the sed script
   40 
   41 All these options are taken as-is from sed itself. Like sed, multiple
   42 scripts can be specified. But, unlike sed, '-e/--expression' option
   43 must be specified even when using only one expression.
   44 
   45 Examples:
   46 
   47   # For all files/directories in the current directory, change spaces to
   48   # underscores, change sequences of several underscores to one underscore.
   49   find . -depth | tmv -e 'y/ /_/' -e 's/_\{2,\}/_/g'
   50 
   51 2.2. Conversion to upper/lower-case
   52 
   53 Pathnames are converted to upper/lower-case using 'dd conv=[lu]case'.
   54 
   55 Options:
   56 
   57   -l, --lcase
   58         convert pathnames to lower case (using 'dd conv=lcase')
   59   -u, --ucase
   60         convert pathnames to upper case (using 'dd conv=ucase')
   61 
   62 I never use '--ucase', but I had to add it for the symmetry with '--lcase'.
   63 
   64 Examples:
   65 
   66   # For all files/directories (not recursively) in new_music, convert
   67   # pathnames to lowercase.
   68   tmv -l new_music/*
   69 
   70 2.3. Character set conversion
   71 
   72 Pathnames are converted from one character set to another using iconv.
   73 
   74 Options:
   75 
   76       --iconv=FROM:TO
   77         convert pathnames from charset FROM to charset TO
   78       --iconv=FROM
   79         convert pathnames from charset FROM to locale (user) charset
   80       --iconv=:TO
   81         convert pathnames from locase (user) charset to charset TO
   82 
   83 Examples:
   84 
   85   # For all file/directories in copy_of_joliet_cd_with_russian_pathnames,
   86   # convert the pathnames' charset from CP1251 to locale (user) charset
   87   find copy_of_joliet_cd_with_russian_pathnames -depth | tmv --iconv=cp1251
   88 
   89 2.4. Transformation with external command(s)
   90 
   91 Pathnames can be transformed by arbitrary external command(s).
   92 
   93 Options:
   94 
   95       --pipe=COMMAND
   96         pipe pathnames through COMMAND; several '--pipe' options can be
   97         specified; commands will be executed in order of their specification
   98 
   99 Examples:
  100 
  101   # Actually, all processing command useful for me are already done as
  102   # built-in transformations, so I'll give an example with sed again.
  103   # For all files in the current directory, change the extension from
  104   # 'htm' to 'html'. Nothing will be done with files not ending with 'htm'.
  105   find . -maxdepth 1 -type f | tmv --pipe='sed "s/htm$/html/"'
  106 
  107 2.5. Other options
  108 
  109   -b, --backup
  110         mv is always run with '-f' option, so if you are afraid tmv might
  111         overwrite some files, you can (with GNU version of mv) use '-b'
  112         option; for details see mv(1)
  113   -q, --quiet
  114         by default, verbose mode is on, displaying some progress information,
  115         and the names of source/destination files; this options makes tmv silent
  116   -n, --dry-run
  117         no files are renamed, but source/destination files are printed (if
  118         not '--quiet', which is pointless in conjunction with this option);
  119         this mode is useful when you're not sure about the correctness of your
  120         sed script(s), don't know the FROM charset and are just guessing etc.
  121 
  122 2.6. Options processing notes
  123 
  124 If you want to specify non-option arguments starting with '-', write them after
  125 a '--', after which all the remaining arguments are treated as options.
  126 
  127 2.7. Little scripts built around tmv
  128 
  129 2.7.1. tmv-ul
  130 
  131 Usage: tmv-ul path [path]*
  132 
  133 'tmv-ul' script finds all files/directories in given path(s), and
  134 change spaces to underscores, converting text to lower case. Accepts
  135 no options (not even '--help' and '--version').
  136 
  137 2.7.2. tmv-strip
  138 
  139 Usage: tmv-strip string
  140 
  141 'tmv-strip' script finds all files in the current directory, containing
  142 a given string, and removes it from them. Accepts no options (not even
  143 '--help' and '--version').
  144 
  145 2.8. Reporting bugs / Sending patches / Requesting enhancements
  146 
  147 If you think you've found a bug, written a patch or want a new
  148 feature badly, feel free to mail me at <heilong@bluebottle.com>.
  149 Be sure to set the subject to 'tmv: bugreport: blah blah blah',
  150 'tmv: patch: blah blah blah' or 'tmv: rfe: blah blah blah'
  151 for bugreport, patch or RFE respectively.
  152 When writing bugreports, be sure to include as much information as
  153 possible. Be absolutely sure to write how to reproduce the bug.