Need a file renaming facility

John C. Lusth jcl at bdrc.COM
Wed May 11 04:54:26 AEST 1988


In article <324 at bdrc.UUCP> jcl at bdrc.UUCP (John C. Lusth) writes:
<Here is a shell script that renames portions of filenames:
<
<#!/bin/csh #########################################################
<#
<#   mv+ pattern1 pattern2 file1 [ file2 ...  ]
<#
<#   rename files by replacing the last pattern1 with pattern2
<
	[shell script and text deleted ]
<
<Every once in a while, this shell script can be quite useful.  You can
<also do things like
<
<    mv+ "[abc]" z *
<
<which replaces the last letter a, b, or, c with z in any file names containing
<an a, b, or, c.  Messing around with regular expressions can be hazardous
<though.  In general, one should use literals for pattern1.

Oops.  In order to use regular expressions for pattern1, insert the line

    set noglob

in the beginning of the script.  Sorry about that.

John C. Lusth
Becton Dickinson Research Center
Research Triangle Park, NC 

...!mcnc!bdrc!jcl



More information about the Comp.unix.questions mailing list