petitp@cui.UUCP (PETITPIERRE Dominique) (06/17/88)
Here is a four lines 'csh' script to rename files. It does not have all the bell and whistles of others renames, but is fast! Please excuse me if such a solution was already posted to the news. In case it gets garbled travelling through the net, please note that the separators on the substitute modifier are literal CTRL-Gs (\007), which could be replaced by any characters unlikely to occur in a file name. #!/bin/csh -f # rename files by substituting the first occurrence of $1 in the name by $2 # Example: # rename .c .h decl.c head.c # will move decl.c to decl.h and head.c to head.h alias chg "mv \!^ \!^:s$1$2" foreach f ($argv[3-]) eval chg $f end -- Mr. Dominique Petitpierre |EAN, BITNET, EARN, MHS, X.400: petitp@cui.unige.ch ISSCO, University of Geneva |UUCP: mcvax!cernvax!cui!petitp , petitp@cui.uucp 54 route des Acacias |JANET: petitp%cui.unige.ch@ean-relay.ac.uk CH-1227 GENEVA (Switzerland)|CSNET, ARPA: petitp%cui.unige.ch@csnet-relay.csnet Tel: 0041/22/20 93 33 extension 2117