home *** CD-ROM | disk | FTP | other *** search
/ back2roots/padua / padua.7z / padua / lang / perl4.035.V010.lzh / perl4.035 / eg / rename.h < prev    next >
Encoding:
Text File  |  1992-08-31  |  2.3 KB  |  84 lines

  1. char *gacScript[] = {
  2. "#!/usr/bin/perl\n",
  3. "'di';\n",
  4. "'ig00';\n",
  5. "#\n",
  6. "# $Header: rename,v 4.0 91/03/20 01:11:53 lwall Locked $\n",
  7. "#\n",
  8. "# $Log:    rename,v $\n",
  9. "# Revision 4.0  91/03/20  01:11:53  lwall\n",
  10. "# 4.0 baseline.\n",
  11. "# \n",
  12. "# Revision 3.0.1.2  90/08/09  03:17:57  lwall\n",
  13. "# patch19: added man page for relink and rename\n",
  14. "# \n",
  15. "\n",
  16. "($op = shift) || die \"Usage: rename perlexpr [filenames]\\n\";\n",
  17. "if (!@ARGV) {\n",
  18. "    @ARGV = <STDIN>;\n",
  19. "    chop(@ARGV);\n",
  20. "}\n",
  21. "for (@ARGV) {\n",
  22. "    $was = $_;\n",
  23. "    eval $op;\n",
  24. "    die $@ if $@;\n",
  25. "    rename($was,$_) unless $was eq $_;\n",
  26. "}\n",
  27. "##############################################################################\n",
  28. "\n",
  29. "    # These next few lines are legal in both Perl and nroff.\n",
  30. "\n",
  31. ".00;            # finish .ig\n",
  32. " \n",
  33. "'di            \\\" finish diversion--previous line must be blank\n",
  34. ".nr nl 0-1        \\\" fake up transition to first page again\n",
  35. ".nr %% 0            \\\" start at page 1\n",
  36. "';<<'.ex'; #__END__ ############# From here on it's a standard manual page ############\n",
  37. ".TH RENAME 1 \"July 30, 1990\"\n",
  38. ".AT 3\n",
  39. ".SH NAME\n",
  40. "rename \\- renames multiple files\n",
  41. ".SH SYNOPSIS\n",
  42. ".B rename perlexpr [files]\n",
  43. ".SH DESCRIPTION\n",
  44. ".I Rename\n",
  45. "renames the filenames supplied according to the rule specified as the\n",
  46. "first argument.\n",
  47. "The argument is a Perl expression which is expected to modify the $_\n",
  48. "string in Perl for at least some of the filenames specified.\n",
  49. "If a given filename is not modified by the expression, it will not be\n",
  50. "renamed.\n",
  51. "If no filenames are given on the command line, filenames will be read\n",
  52. "via standard input.\n",
  53. ".PP\n",
  54. "For example, to rename all files matching *.bak to strip the extension,\n",
  55. "you might say\n",
  56. ".nf\n",
  57. "\n",
  58. "    rename 's/\\e.bak$//' *.bak\n",
  59. "\n",
  60. ".fi\n",
  61. "To translate uppercase names to lower, you'd use\n",
  62. ".nf\n",
  63. "\n",
  64. "    rename 'y/A-Z/a-z/' *\n",
  65. "\n",
  66. ".fi\n",
  67. ".SH ENVIRONMENT\n",
  68. "No environment variables are used.\n",
  69. ".SH FILES\n",
  70. ".SH AUTHOR\n",
  71. "Larry Wall\n",
  72. ".SH \"SEE ALSO\"\n",
  73. "mv(1)\n",
  74. ".br\n",
  75. "perl(1)\n",
  76. ".SH DIAGNOSTICS\n",
  77. "If you give an invalid Perl expression you'll get a syntax error.\n",
  78. ".SH BUGS\n",
  79. ".I Rename\n",
  80. "does not check for the existence of target filenames, so use with care.\n",
  81. ".ex\n",
  82. "\n",
  83. NULL
  84. };