- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Easy Points - sed/awk help again
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
тАО08-16-2002 11:35 AM
тАО08-16-2002 11:35 AM
Sample before data:
robert d anderson
steven g johnson
joseph wilson
andrew j jones
Sample after data:
Robert D Anderson
Steven G Johnson
Joseph wilson
Andrew J Jones
Thanks again,
Greg
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-16-2002 11:48 AM
тАО08-16-2002 11:48 AM
SolutionThis is kid of beside the point, but I posted a question recently for online learning sites, in it are a couple of nice pages on awk and sed.
http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0xf5384b3ef09fd611abdb0090277a778c,00.html
Also, if you have some good online learning sites and want to share, post them and I'll give you easy points. ;)
Thanks,
Kel
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-16-2002 11:50 AM
тАО08-16-2002 11:50 AM
Re: Easy Points - sed/awk help again
(That's cute! Meant kind.)
N/A please.
Kel
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-16-2002 11:53 AM
тАО08-16-2002 11:53 AM
Re: Easy Points - sed/awk help again
Would you mind if I don't use awk and sed?.
Following is one quick primitive way of doing.
"file" is where your data is.
cat file |while read LINE
do
for WORD in $LINE
do
FIRST=`echo $WORD |cut -c 1|tr -s '[:lower:]' '[:upper:]'`
NEXT=`echo $WORD |cut -c 2-`
printf "${FIRST}${NEXT} "
done
printf "\n"
done
-Sri
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-16-2002 12:19 PM
тАО08-16-2002 12:19 PM
Re: Easy Points - sed/awk help again
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-16-2002 12:30 PM
тАО08-16-2002 12:30 PM
Re: Easy Points - sed/awk help again
Here is a short perl routine.
cat file | perl -e 'while(<>) { while(/(\S+)(\s+)/g) {print ucfirst($1),$2 }}'
Hope this helps.
-- Rod Hills
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-16-2002 12:31 PM
тАО08-16-2002 12:31 PM
Re: Easy Points - sed/awk help again
cat test | perl -e 'while (<>) {s/(\w+)/\u$1/g;print}'
Tom
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-16-2002 12:32 PM
тАО08-16-2002 12:32 PM
Re: Easy Points - sed/awk help again
fasprd01:/home/tjohnson:570$ cat tom.txt
robert d anderson
steven g johnson
joseph wilson
andrew j jones
fasprd01:/home/tjohnson:571$ cat tom.txt | awk -f cap1stletter.awk
Robert D Anderson
Steven G Johnson
Joseph Wilson
Andrew J Jones
fasprd01:/home/tjohnson:572$ cat cap1stletter.awk
# capitalize 1st letter in string
function capital(input, result, words, n, i, w)
{
result = ""
n = split(input, words, " ")
for (i - 1; i <= n; i++) {
w = words[i]
w = toupper(substr(w, 1, 1)) substr(w, 2)
if (i > 1)
result = result " "
result = result w
}
return result
}
{ print capital($0) }
fasprd01:/home/tjohnson:573$
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-16-2002 12:42 PM
тАО08-16-2002 12:42 PM
Re: Easy Points - sed/awk help again
Greg