The UNIX and Linux Forums  

Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
convert pdf's to word gefa Windows & DOS: Issues & Discussions 3 02-10-2009 04:44 AM
read a line from a csv file and convert a column to all caps orahi001 UNIX for Dummies Questions & Answers 3 12-31-2007 06:05 PM
convert special character like £ cynnie Shell Programming and Scripting 1 08-08-2007 06:37 AM
Change Position of word character cedrichiu Shell Programming and Scripting 6 03-12-2007 01:52 AM
Grep for X character on a word jjoves UNIX for Dummies Questions & Answers 5 08-06-2004 05:14 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 04-01-2008
vadharah vadharah is offline
Registered User
  
 

Join Date: Mar 2008
Posts: 27
Question Convert character in word to CAPS??

Hi Gurus!!

Is it possible to change a letter in a word to CAPS??
When correcting a paragraph i need to covert the word if it appears at the start of a line to caps.......

if i had a phrase like

my name is james and would like to sign up.

how do i convert "my" to "My"

or

the Essex batsman and former hamp captain, has been named as assistant

is it possible to convert "the" to "The"
  #2 (permalink)  
Old 04-01-2008
sparcguy sparcguy is offline Forum Advisor  
Registered User
  
 

Join Date: Nov 2006
Posts: 315
readup unix man pages for tr
  #3 (permalink)  
Old 04-01-2008
vadharah vadharah is offline
Registered User
  
 

Join Date: Mar 2008
Posts: 27
Quote:
Originally Posted by sparcguy View Post
readup unix man pages for tr
Thanks did some reading but....

i have the word as "my" but failing to specify and check if its at the begining of line and to select just the first character


my name is james and would like to sign up..............

tr "m" "M" < filesource

this is when you know the first letter how do i specify if i dont know the first character?

i have also tried something of this sort

echo $word | sed -e 's/\(.\)\(.*\)/\[:upper:]\1\(.\)/I'

but to no avail
  #4 (permalink)  
Old 04-01-2008
Dave Miller's Avatar
Dave Miller Dave Miller is offline
Registered User
  
 

Join Date: Dec 2007
Location: Northern NJ, USA
Posts: 151
This is no help, but tr won't do it. In your example, tr "m" "M" will convert EVERY occurance of a lowercase 'm' to uppercase 'M'.

I.E. Your sample will yield:

My naMe is jaMes and would like to sign up.

tr [a-z] [A-Z] is a handy tool to convert to all caps. But that won't help you convert just the first character.
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 04:00 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0