Skip to Content.
Sympa Menu

baslinux - Re: [BL] bash help; changing case of file names, hyperlinks

baslinux AT lists.ibiblio.org

Subject: Baslinux mailing list

List archive

Chronological Thread  
  • From: "Sheldon Isaac" <sheldon.isaac AT verizon.net>
  • To: baslinux AT lists.ibiblio.org
  • Subject: Re: [BL] bash help; changing case of file names, hyperlinks
  • Date: Fri, 23 Feb 2007 15:52:57 -0500

On 23 Feb 2007 at 13:03, James Miller wrote, in part:

> What I therefore need to do is convert the relevant file names, whether
> under their resident directory, or within the html files themselves, to
> either upper or lower case. It could be alot more complex to do this if
> the file names varied more than they do, but as things stand, there are
> only 5 words that need their case changed.
>
> For demonstration purposes, let's say that the relevant words are index,
> htm, word1,
> word2, and word3. What would be the automated way to change all instances
> of index,
> htm, word1, word2, and word3 to INDEX, HTM, WORD1, WORD2, and WORD3? I
> suppose the
> routine for doing this would be different for renaming the files than it
> would be for
> changing the case of hyperlinks inside an html file. Any help on this would
> be much
> appreciated.

James, the below work for changing 1 file name; maybe there's something one
does
with for , or perhaps redirect input from a file with a list of the file
names
trhatneed changing?

May I add that this works on a remote system using bash - don't remember
whether it works under BL3.


---------

#!/usr/local/bin/bash
mv $1 `echo $1 | tr '[a-z]' '[A-Z]' `

-------

Let's say this script is called xc.

So

xc something.htm

would change it to SOMETHING.HTM








Archive powered by MHonArc 2.6.24.

Top of Page