home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / unix / misc / 3492 < prev    next >
Encoding:
Text File  |  1992-09-03  |  1.3 KB  |  39 lines

  1. Newsgroups: comp.unix.misc
  2. Path: sparky!uunet!haven.umd.edu!darwin.sura.net!udel!rochester!cornell!batcomputer!lynx.msc.cornell.edu!tamar.msc.cornell.edu!dchin
  3. From: dchin@tamar.msc.cornell.edu (David W. Chin)
  4. Subject: How to add a suffix to a bunch of files?
  5. Message-ID: <1992Sep3.213646.26527@msc.cornell.edu>
  6. Keywords: shell, script, files, names
  7. Sender: news@msc.cornell.edu
  8. Organization: Cornell-Materials-Science-Center
  9. Date: Thu, 3 Sep 1992 21:36:46 GMT
  10. Lines: 27
  11.  
  12. I have occasion to add suffices on a whole bunch of files, like a .1 suffix on
  13. all files in cat1 (just an example).  What's an elegant way to do it?
  14. The one I thought of was:
  15.  
  16. #!/bin/sh
  17. cd cat1
  18. for X in `ls -1`
  19.     do
  20.     eval "mv $X $X.1"
  21.     done
  22.  
  23. Thanks a lot in advance.  (I hope this is not in an FAQ somewhere -- seems like
  24. something which is commonly done.)
  25.  
  26.  
  27. David Chin                 Cornell University '92
  28.  
  29. ________________________________________________________________________
  30. Internet:                       |        
  31.   dchin@helios.tn.cornell.edu   |        
  32. Bitnet:                         |        Phone:  (607) 257-6576
  33.   iojj@crnlassp                 |        Add:  401 Thurston Ave., Ithaca
  34.   iojj@crnlvax5                 |              NY 14850-2431
  35.   iojj@crnla                    |        Shoe size:  8 1/2
  36. ________________________________|_______________________________________
  37.  
  38.  
  39.