LinuxSA Mailing list archives

Index: [thread] [date] [subject] [author]
  From: Daryl Tester <dt@picknowl.com.au>
  To  : LinuxSA <linuxsa@linuxsa.org.au>
  Date: Mon, 03 Apr 2000 17:43:13 +0930

Re: changing case of file names

Alan Kennington wrote:

> If you want something more sophisticated, like change the
> names of only those files which are all-caps, and remove
> VMS file version numbers, then you need a C program, like

for i in *; do
  if echo $i | egrep -q '^[0-9A-Z.]+$'; then
    mv $i `echo $i | tr [:upper:] [:lower:]`
  fi
done

Granted, not as efficient as a C program, but given the
run-time vs number of times run (plus < 1 minute to write) ...

To remove VMS versioning (from memory "foo.bar;12"), add a
semicolon to the egrep test on line 2, and add
"| sed 's/;[0-9]*$//'" to the backticks on line 3 to strip
everything after the semicolon.

Regards,
  Daryl Tester

-- 
LinuxSA WWW: http://www.linuxsa.org.au/  IRC: #linuxsa on irc.linux.org.au
To unsubscribe from the LinuxSA list:
  mail linuxsa-request@linuxsa.org.au with "unsubscribe" as the subject


Index: [thread] [date] [subject] [author]
Return to the LinuxSA Mailing List Information Page