Capitalize the 1st letter of each word

Last update on February 22, 2009 11:43 AM by aakai1056
Published by deri58

Capitalize the 1st letter of each word








Below are two ways to proceed:

Method 1
sed-r 's /(^.|.) / \ U & / g'

Method 2
sed 's / ^. \ | [a-z] / \ U & / g'

Method 3
sed-r 's / \ <. / \ U & / g'

Examples:
$ Echo-e "good day to you | Sed-r 's /(^.|.) / \ U & / g'
Good Day To You.

$ Echo-e "hello life \ net hello to you" | sed-r 's /(^.|.) / \ U & / g'
or
$ Echo-e "hello life \ net hello to you" | sed-r 's / (\ b) / \ U & / g'
Hello Life
And Hello To You

$ Echo-e "hello life." | Sed 's / ^. \ | [A-z] / \ U & / g'
Hello Life.

$ Echo-e "hello life \ net hello to you" | sed 's / ^. \ | [Az] / \ U & / g'
Hi Life
And Hello To You
Best answers for « Capitalize the 1st letter of each word » in :
Inserting space between each letter Show Inserting space between each letter $ echo -e "How are you\n everything alright" | sed 's/./& /g' H o w a r e y o u E v e r y t h i n g a l r I g h t The disadvantage is that the natural space between each word...
Inserting a space between each letter ShowInserting a space between each letter Insert a space between each letter. $ echo -e "hello life\nand hello to you" | sed 's/./& /g' h el l o l i f e a n d h e l l o t o y o u The problem is that the natural space between...
Set the first letter of a word in capital ShowSet the first letter of a word/phrase in capital Gsed 4.0 and higher sed 's/^./\u&/' Example : $ echo "how are you" | sed 's/^./\u&/' How are you $ echo -e "how are you/ everything alright" | sed 's/^./\u&/' How are...
[Outlook Express] Create letter paper / Insert background image Show[Outlook Express] Create letter paper / Insert background image The letter paper is an Outlook Express feature allowing sending emails with illustrations (images, text, etc.) as background. Creating letterhead under Outlook Express In the...
Download GText ShowDo you have visual problems? Is the page that you are reading is fuzzy or illegible? Don’t worry! GText can solve your problem. This program displays sequentially each word of the selected text in your page, which means one word at a time. To do...
Download Quick Word to PDF ShowTo transfer your documents most in possible security, there is not better than format PDF. Then, to convert your documents Word into PDF, adopt the quick program Word to PDF. Quick Word to PDF is a tool which integrates with the interface of...
Worksheet - Cells ShowThe Concept of a Cell A "cell" is the intersection between a line (horizontal) and a column (vertical) on a worksheet. Thus, the name of the line combined with the name of the column gives the cell's coordinates (the term address is sometimes also...
The keyboard ShowIntroduction to the keyboard The keyboard, like a typewriter, is used for entering characters (such as letters, numbers, and symbols). It is an essential input device for a computer, as it is what lets us enter commands. The term "QWERTY" (after...
Project stages ShowThe stages of the project In order to be managed in an atmosphere of quality, a project must pass through various phases, at the end of which milestones should be defined. Each stage is related to a deliverable and a validation based on a specific...