- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- converting uppercase to lowercase characters
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-26-2004 09:12 PM
тАО10-26-2004 09:12 PM
How do i convert a word written in all uppercase caracters to a word with only the first character uppercase and the rest lowercase ?
example:
"WOORD IN EEN ZIN" -> "Woord In Een Zin"
Thanks in advance
kl@@s
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-26-2004 09:24 PM
тАО10-26-2004 09:24 PM
SolutionWoord In Een Zin
lt09:/home/merijn 108 > echo WOORD IN EEN ZIN | perl -pe's/(\w+)/\L\u$1/g'
Woord In Een Zin
lt09:/home/merijn 109 >
Enjoy, Have FUN! H.Merijn
- Tags:
- Perl
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-26-2004 09:37 PM
тАО10-26-2004 09:37 PM
Re: converting uppercase to lowercase characters
am i doing something wrong ?
klaas
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-26-2004 09:54 PM
тАО10-26-2004 09:54 PM
Re: converting uppercase to lowercase characters
if you get
# perl -v
This is perl, version 4.0
$RCSfile: perl.c,v $$Revision: 4.0.1.8 $$Date: 1993/02/05 19:39:30 $
Patch level: 36
Copyright (c) 1989, 1990, 1991, Larry Wall
Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 4.0 source kit.
you have an ancient perl installed on /usr/contrib/bin, and that version does not support the fact that the script (the -e part) is tight to the -e option without space separation :(
a5:/u/usr/merijn 101 > echo WOORD IN EEN ZIN | perl -pe's/(\w+)/\L\u$1/g'
Woord In Een Zin
a5:/u/usr/merijn 102 > echo WOORD IN EEN ZIN | perl4 -pe's/(\w+)/\L\u$1/g'
WOORD IN EEN ZIN
a5:/u/usr/merijn 103 > echo WOORD IN EEN ZIN | perl4 -pe 's/(\w+)/\L\u$1/g'
Woord In Een Zin
a5:/u/usr/merijn 104 >
If you only have that perl4, just add a space, as above example shows.
My advice would be to chack if you have other versions of perl installed, and move /usr/contrib/bin to the *end* of your $PATH.
Almost every perl script snippet posted on the forum expects at least perl-5.005_3, and I only use perl-5.8.5
more modern perls are usually installed as either /usr/local/bin/perl or in /opt/perl/bin/perl
[ Leuk om weer een nieuwe nederlandstalige te mogen verwelkomen :) ]
Enjoy, Have FUN! H.Merijn
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-26-2004 10:11 PM
тАО10-26-2004 10:11 PM
Re: converting uppercase to lowercase characters
Pete
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-26-2004 10:18 PM
тАО10-26-2004 10:18 PM
Re: converting uppercase to lowercase characters
Not what he wants.
Enjoy, Have FUN! H.Merijn
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-26-2004 10:46 PM
тАО10-26-2004 10:46 PM
Re: converting uppercase to lowercase characters
Pete
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-27-2004 12:58 AM
тАО10-27-2004 12:58 AM
Re: converting uppercase to lowercase characters
#! /bin/sed -f
# capit.sed -- capitalize words
#
# split words into \n word
s/[a-zA-Z][a-zA-Z]\+/\
&/g
# add conversion table: \n\n table
# table format:
s/$/\
\
AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz/
# subs every lower case first char
ta
:a
s/\n\(.\)\(.*\n\n.*\)\([A-Z]\)\1/\3\2\3\1/
ta
# cleanup...
s/\n\n.*//
s/\n//g
Rgds...Geoff
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-27-2004 01:18 AM
тАО10-27-2004 01:18 AM
Re: converting uppercase to lowercase characters
You can (mis)use ksh special features, e.g.:
#!/usr/bin/sh
LIST="WOORD IN EEN ZIN"
function convert
{
FUP="$1"
END_F=${FUP#?}
REST_LOW=$(echo "$END_F" | tr "[:upper:]" "[:lower:]")
typeset -u BEG_F=${FUP%$END_F}
echo "$BEG_F$REST_LOW"
}
for i in $LIST
do
convert "$i"
done
regards,
John K.
- Tags:
- tr
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-27-2004 01:25 AM
тАО10-27-2004 01:25 AM
Re: converting uppercase to lowercase characters
perl -pe 's/(\w+)/\L\u$1/g'
is all you need, and I even showed it works in perl4, which is available on every HP-UX box older than 11i (11.11 and up have perl5 installed by default)
Enjoy, Have FUN! H.Merijn