home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.unix.misc
- Path: sparky!uunet!utcsri!torn!newshub.ccs.yorku.ca!yorku.ca!rreiner
- From: rreiner@nexus.yorku.ca (Richard Reiner)
- Subject: Re: How to add a suffix to a bunch of files?
- Message-ID: <rreiner.715704103@yorku.ca>
- Sender: news@newshub.ccs.yorku.ca (USENET News System)
- Organization: York University
- References: <1992Sep3.213646.26527@msc.cornell.edu> <JDELL.92Sep4152056@nefertiti.mit.edu> <ellis.715700967@nova>
- Date: Sat, 5 Sep 1992 14:41:43 GMT
- Lines: 26
-
- On Thu, 3 Sep 1992 21:36:46 GMT, dchin@tamar.msc.cornell.edu (David W. Chin) said:
-
- >I have occasion to add suffices on a whole bunch of files, like a .1 suffix on
- >all files in cat1 (just an example). What's an elegant way to do it?
-
- Easy sh and csh solutions have been given, but it's worth pointing out
- that the program mmv (available in all the usual places) excels at
- this kind of stuff. In fact, it is much more general. For instance,
- you can do
-
- mmv '*foo*bar*' '#2fiz#3bat#1#2'
-
- The #<digit> expressions in the target name work as you'd expect: #1
- is replaced with whatever matched the first '*' in the source, etc.;
- and each can be used as many times as one likes. A very useful tool.
-
- So the solution to the present problem, using mmv, is just
-
- mmv '*' '#1.1'
-
-
- --
- Richard Reiner........rreiner@nexus.yorku.ca........416-538-3947
-
- Learning, n. The kind of ignorance distinguishing the studious.
- -- Ambrose Bierce, _The Devil's Dictionary_.
-