Changing capitalization


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Changing capitalization
# 1  
Old 11-02-2005
Changing capitalization

How would I go about taking a string, such as a name (first last) and changing the capitalization of the first letter of each name (First Last)?

A script that I am using outputs a list of names in all lower case, and I need to process the whole list to a new outfile giving the new capitalization.

Thanks!!
# 2  
Old 11-02-2005
Code:
ruby -pe 'gsub(/\w+/){|name| name.capitalize}'

# 3  
Old 11-09-2005
Code:
echo 'joe shmoe' | nawk '{for(i=1;i<=NF;i++)sub(/./,toupper(substr($i,1,1)),$i)}1'

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Changing TZ from a script

Hi i have a case statement so when the user selects a differnent timezone the TZ value should change, so when another script generates a html page the when date is displayed the time corresponds to the timezone selected. I can't get the TZ to change when using a script but can change the TZ by... (7 Replies)
Discussion started by: scriptnewbie
7 Replies

2. Homework & Coursework Questions

Changing a file

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: Make “hardlink” readable, writeable, executable by you, but not readable, writeable, executable by anyone else.... (4 Replies)
Discussion started by: lilbo4231
4 Replies

3. Shell Programming and Scripting

simple Word Capitalization (Title) find/replace

Hi! I'm looking for a simple script, especially a one liner script in tcsh or bash that will emulate the find/replace in all text apps. I want to change all uppercase caracters to Title word (in wich only the first caracter is UpperCase and the rest is lowercase) I can use sed command, but... (2 Replies)
Discussion started by: sstpierre68
2 Replies

4. UNIX for Dummies Questions & Answers

Changing / to - with vi

Hi just learning Unix in college now and this is my first post here, so I dunno if this goes here, or in the homework section technically. Anywho, trying to change all the / in a file into - using vi... i went into the command prompt, and put in :%s///-/g and it comes up with E488: Trailing... (2 Replies)
Discussion started by: SoVi3t
2 Replies

5. Solaris

Defaultrouter not changing !!

Hi experts I have to change the default router of some system I tried changing by deleing the existing route by following line #route delete default 172.24.2.101 then I added executed the below line to add the new router #route add default 172.24.1.254 ... (9 Replies)
Discussion started by: kumarmani
9 Replies

6. Shell Programming and Scripting

awk is changing my FS !!

Hello there, Here is (a part) of the file I want to change. Note the three spaces before the "3" (could be "2" or "0" also). 3 621530 1.1935E-02 631530 1.1293E+01 641530 1.1117E-02 571540 4.4419E-14 3 581540 2.6670E-10 591540 3.8610E-09 601540 1.1016E-06 611540 3.2618E-06 ... (4 Replies)
Discussion started by: jolecanard
4 Replies

7. Shell Programming and Scripting

Changing userID and Changing group and GID

Hello, I want to write a ksh script about changing UID and changing group with GID. There are multiple servers i want to perform that job. linux1 linux2 linux3 linux4 linux5 ...... . . . . . 1.) How can i enter "password" in script rather asking me? I was trying this... ssh... (2 Replies)
Discussion started by: deal732
2 Replies

8. Filesystems, Disks and Memory

changing group ID

My current GID are all < 100, however I am having issues now with this. Does anyone know of a way to change all GID's to perhaps add 100, IE so GID now = 23 will = 123. I am running an NIS network so changing the table is easy , however finding all the files on all my filesystems and modifying... (4 Replies)
Discussion started by: frankkahle
4 Replies

9. OS X (Apple)

(OSX) Capitalization using tr

Mac OSX Terminal/Unix question I would like to capitalize the words at the beggining of sentences using the tr command, im not sure if this is possible, if not please tell me another way, I oly have TextEdit, no auto capitalization so just having a quick Unix way 'round it would be great. (2 Replies)
Discussion started by: H1tokori
2 Replies

10. IP Networking

Changing the ip address

Help me save my Unix box. I've had this Unix box (Enterprise 450) for about 7 years now. It was being used as a file server for a Macintosh Prepress department. All of our networking was done through Helios Etharshare. I am still currently up and online (however the location has changed). Our ip... (1 Reply)
Discussion started by: ubed
1 Replies
Login or Register to Ask a Question