LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
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, 08:48 PM   #1
DavidPhillips
LQ Guru
 
Registered: Jun 2001
Location: South Alabama
Distribution: Fedora / RedHat / SuSE
Posts: 7,163

Rep: Reputation: 58
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-14-2002, 11:00 PM   #2
neo77777
LQ Addict
 
Registered: Dec 2001
Location: Brooklyn, NY
Distribution: *NIX
Posts: 3,704

Rep: Reputation: 56
Look at tr, and speifically at perl.
 
Old 09-14-2002, 11:09 PM   #3
DavidPhillips
LQ Guru
 
Registered: Jun 2001
Location: South Alabama
Distribution: Fedora / RedHat / SuSE
Posts: 7,163

Original Poster
Rep: Reputation: 58
ok thanks
 
Old 09-18-2002, 09: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, 10:37 AM   #5
DavidPhillips
LQ Guru
 
Registered: Jun 2001
Location: South Alabama
Distribution: Fedora / RedHat / SuSE
Posts: 7,163

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

thanks
 
Old 04-02-2005, 10: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, 04: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



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 02:13 PM
Converting sLoPPy cASE to Pretty Case with tr lowpro2k3 Programming 4 04-13-2005 08: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 04:09 PM
change case in perl? bigearsbilly Programming 3 01-20-2005 07:08 AM
Lower case to upper case letter sudhasmyle Programming 1 12-03-2004 04:15 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 06:18 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
Open Source Consulting | Domain Registration