home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / unix / misc / 3654 < prev    next >
Encoding:
Text File  |  1992-09-13  |  870 b   |  29 lines

  1. Newsgroups: comp.unix.misc
  2. Path: sparky!uunet!murphy!jpradley!jpr
  3. From: jpr@jpradley.jpr.com (Jean-Pierre Radley)
  4. Subject: Re: How to add a suffix to a bunch of files?
  5. Organization: Unix in NYC
  6. Date: Sun, 13 Sep 1992 23:38:42 GMT
  7. Message-ID: <1992Sep13.233842.28641@jpradley.jpr.com>
  8. Keywords: shell, script, files, names
  9. References: <1992Sep3.213646.26527@msc.cornell.edu>
  10. Lines: 17
  11.  
  12. In article <1992Sep3.213646.26527@msc.cornell.edu> dchin@tamar.msc.cornell.edu (David W. Chin) writes:
  13. >I have occasion to add suffices on a whole bunch of files, like a .1 suffix on
  14. >all files in cat1 (just an example).  What's an elegant way to do it?
  15. >The one I thought of was:
  16. >
  17. >#!/bin/sh
  18. >cd cat1
  19. >for X in `ls -1`
  20. >    do
  21. >    eval "mv $X $X.1"
  22. >    done
  23. >
  24.  
  25.  
  26. ls cat1 | xargs -iDWChin mv DWChin DWChin.1
  27. -- 
  28. Jean-Pierre Radley   Unix in NYC   jpr@jpr.com   jpradley!jpr   CIS: 72160,1341
  29.