LinuxQuestions.org
Visit Jeremy's Blog.
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 06-04-2008, 03:45 AM   #1
frenchn00b
Senior Member
 
Registered: Jun 2007
Location: E.U., Mountains :-)
Distribution: Debian, Etch, the greatest
Posts: 2,546

Rep: Reputation: 57
In a text how to lowercase the word, but not the first char?


and to leave the all lowercase like they are.

thanks
 
Old 06-04-2008, 04:27 AM   #2
ghostdog74
Senior Member
 
Registered: Aug 2006
Posts: 2,697
Blog Entries: 5

Rep: Reputation: 244Reputation: 244Reputation: 244
after 1112 post, surely you can come up with something , at least?
 
Old 06-04-2008, 04:31 AM   #3
Hko
Senior Member
 
Registered: Aug 2002
Location: Groningen, The Netherlands
Distribution: Debian
Posts: 2,530

Rep: Reputation: 110Reputation: 110
Wordpad does not have this features AFAIKS.
 
Old 06-04-2008, 04:33 AM   #4
hro
LQ Newbie
 
Registered: Jan 2008
Distribution: OpenSuse 10.3, SLED 10 SP2, Ubuntu 8.04 and 9.04
Posts: 23

Rep: Reputation: 15
~> x=$(echo "asrtp"); echo -n ${x:0:1}; echo ${x:1} | tr [:lower:] [:upper:]
aSRTP
~>
 
Old 06-04-2008, 04:55 PM   #5
frenchn00b
Senior Member
 
Registered: Jun 2007
Location: E.U., Mountains :-)
Distribution: Debian, Etch, the greatest
Posts: 2,546

Original Poster
Rep: Reputation: 57
Quote:
Originally Posted by hro View Post
~> x=$(echo "asrtp"); echo -n ${x:0:1}; echo ${x:1} | tr [:lower:] [:upper:]
aSRTP
~>
amazing line code !!
I try to learn this trick !!
thanks that's very great !!
 
Old 06-05-2008, 06:34 AM   #6
Telemachos
Member
 
Registered: May 2007
Distribution: Debian
Posts: 754

Rep: Reputation: 59
Your original question seemed to request: make the word all lower case, except the first letter. For that, try this:
Code:
perl -e '$string = "WORD"; print "\L\u$string\n";'
But then you seemed happy with the opposite: make the word all upper case, except the first letter. For that, try this:
Code:
perl -e '$string = "WORD"; print "\U\l$string\n";'
That would give you this:
Code:
telemachus ~ $ perl -e '$string = "WORD"; print "\L\u$string\n";'
Word
telemachus ~ $ perl -e '$string = "WORD"; print "\U\l$string\n";'
wORD
Maybe a better question is what do you really want to do and why?
 
Old 06-05-2008, 06:50 AM   #7
vikas027
Senior Member
 
Registered: May 2007
Location: Sydney
Distribution: RHEL, CentOS, Ubuntu, Debian, OS X
Posts: 1,305

Rep: Reputation: 107Reputation: 107
Nice example Telemachos!
 
  


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
how to strip first word then every other line from text? Mandra Programming 6 12-04-2007 08:44 PM
samba replaces Uppercase char in filenames to lowercase srikz Other *NIX 3 03-03-2006 08:59 AM
samba replaces Uppercase char in filenames to lowercase srikz Red Hat 1 10-26-2004 03:47 AM
C: Best way to read an entire text file and putting it in a *char. Claus Programming 8 03-15-2004 01:22 PM
text select Abi Word thegreatgatsby Linux - Software 8 02-20-2004 03:51 AM

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

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