LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices



Reply
 
Search this Thread
Old 09-14-2002, 09:48 PM   #1
DavidPhillips
Guru
 
Registered: Jun 2001
Location: South Alabama
Distribution: Fedora / RedHat / SuSE
Posts: 7,155

Rep: Reputation: 56
Change Case


Wassup!

I need to change a group of files names to all lower case.
I also need to change the contents of a group of text files to lower case.
I need to do it in all files under a given folder, in all subfolders.

Thanks
 
Old 09-15-2002, 12:00 AM   #2
neo77777
LQ Addict
 
Registered: Dec 2001
Location: Brooklyn, NY
Distribution: *NIX
Posts: 3,704

Rep: Reputation: 55
Look at tr, and speifically at perl.
 
Old 09-15-2002, 12:09 AM   #3
DavidPhillips
Guru
 
Registered: Jun 2001
Location: South Alabama
Distribution: Fedora / RedHat / SuSE
Posts: 7,155

Original Poster
Rep: Reputation: 56
ok thanks
 
Old 09-18-2002, 10:09 AM   #4
TheLinuxDuck
Member
 
Registered: Sep 2002
Location: Tulsa, OK
Distribution: Slack, baby!
Posts: 349

Rep: Reputation: 33
This will do the same thing:
Code:
 for i in `find . -type f`; do mv $i `echo "$i" | tr 'A-Z' 'a-z'`; done
It will complain about files whose names are already all lowercase, but it works recursively and such... just another option without having to shell to perl...
 
Old 09-18-2002, 11:37 AM   #5
DavidPhillips
Guru
 
Registered: Jun 2001
Location: South Alabama
Distribution: Fedora / RedHat / SuSE
Posts: 7,155

Original Poster
Rep: Reputation: 56
great thats what I was looking for

thanks
 
Old 04-02-2005, 11:50 AM   #6
djionel82
LQ Newbie
 
Registered: Apr 2005
Location: Romania
Distribution: fc3
Posts: 13

Rep: Reputation: 0
case change ...

hi!
I am also interested in changing the case of some files in linux fc3
i tried the code like the above code like this:
as root,
I created a file named lowcase and I wrote:
Code:
#!/bin/bash
for i in `find . -type f`; do mv $i `echo "$i" | tr 'A-Z' 'a-z'`; done
exit 0
then I used chmod u+x lowcase
and then I tried to use it like this:
./lowcase X
where X was the name of a file in the working directory

it didn't work
help me out pls, maybe I did smth wrong...
I am quite new at using linux ...
 
Old 04-02-2005, 05:45 PM   #7
djionel82
LQ Newbie
 
Registered: Apr 2005
Location: Romania
Distribution: fc3
Posts: 13

Rep: Reputation: 0
i found out the problem

the solution is very simple yet so stupid ....
the ideea is that when I wrote
Code:
for i in 'find . -type f'
I used the ' character (nest to ENTER key) instead of the ` character (under ESC key)
stupid solution ...
then everything worked
sorry to bother you
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
change case of a string (TOUPPER) in shell script raees Linux - Software 3 05-03-2005 03:13 PM
Converting sLoPPy cASE to Pretty Case with tr lowpro2k3 Programming 4 04-13-2005 09:13 PM
Why are all my upper case files being shown as lower case?? [Kernel 2.6.9-1.667 FC3] t3gah Fedora 4 03-11-2005 05:09 PM
change case in perl? bigearsbilly Programming 3 01-20-2005 08:08 AM
Lower case to upper case letter sudhasmyle Programming 1 12-03-2004 05:15 AM


All times are GMT -5. The time now is 11:29 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration