- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- changing case of first letter in a string
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
Forums
Discussions
Discussions
Discussions
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
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
03-17-2004 05:19 AM
03-17-2004 05:19 AM
for eg
philly -> Philly
Any help ?
thanks.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-17-2004 05:37 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-17-2004 05:44 AM
03-17-2004 05:44 AM
Re: changing case of first letter in a string
I'll do it mainly in Shell in case you don't want to use (much) Perl:
#!/usr/bin/sh
VARS="dog cat possum"
for VAR in ${VARS}
do
UVAR=$(echo "${VAR}" | perl -e 'while (<>) {print ucfirst $_};')
echo "${VAR} -> ${UVAR}"
done
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-17-2004 05:44 AM
03-17-2004 05:44 AM
Re: changing case of first letter in a string
So if you had a script called "script" then "script philly" would yield "Philly".
I'm tied up right now or I'd work on something that could process a whole file.
#!/bin/sh
myfirst=`echo $1 | cut -c1 | tr "[:lower:]" "[:upper:]"`
myrest=`echo $1 | cut -c2-128 `
echo $myfirst$myrest
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-17-2004 06:07 AM
03-17-2004 06:07 AM
Re: changing case of first letter in a string
the korn shell has some functions that can be used creatively - perhaps this is overdoing it:
# unset FUP
# FUP=fup
# END_F=${FUP#?}
# typeset -u BEG_F=${FUP%$END_F}
# echo "$BEG_F$END_F"
Fup
regards,
John K.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-17-2004 06:39 AM
03-17-2004 06:39 AM
Re: changing case of first letter in a string
> set name = philly
> echo $name:u
> Philly
You can get it from:
http://hpux.cs.utah.edu/hppd/cgi-bin/search
Elena.