Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


How u convert string "hi pravin how are you?" to
"Hi Pravin How Are You?"

Answers were Sorted based on User's Feedback



How u convert string "hi pravin how are you?" to "Hi Pravin How Are You?" ..

Answer / nachikethas

use a perl one liner like this

perl -e '$var="hi pravin how are you";@arr=split("
",$var);foreach $wrd(@arr){print ucfirst($wrd)." ";}'

Is This Answer Correct ?    8 Yes 5 No

How u convert string "hi pravin how are you?" to "Hi Pravin How Are You?" ..

Answer / padmakumar

The file "test" contains "hi pravin how are you?".

sed -e "s/^[a-z]/\U&/" -e "s/[[:space:]][a-z]/ \U&/g" test

Is This Answer Correct ?    5 Yes 2 No

How u convert string "hi pravin how are you?" to "Hi Pravin How Are You?" ..

Answer / vipul dalwala

echo "hi pravin how are you?" | awk 'BEGIN { ORS = ""
upper = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
lower = "abcdefghijklmnopqrstuvwxyz" }
{
for (i = 1; i <= NF; i++) {
FC = substr($i, 1, 1)
if (C = index(lower, FC))
FC = substr(upper, C, 1)
print FC substr($i,2) " "
}
print "\n"
}'

Is This Answer Correct ?    3 Yes 1 No

How u convert string "hi pravin how are you?" to "Hi Pravin How Are You?" ..

Answer / saravanan

$line = "hi Praveen How are you";

$line =~ s/\b(\w+)\b/ucfirst($1)/e;


print $line;

Is This Answer Correct ?    2 Yes 0 No

How u convert string "hi pravin how are you?" to "Hi Pravin How Are You?" ..

Answer / mahfooz

echo hi praveen how are you | tr ' ' '\n' | perl -n -
e 'print "\u$_"' | tr '\n' ' '

Is This Answer Correct ?    1 Yes 0 No

How u convert string "hi pravin how are you?" to "Hi Pravin How Are You?" ..

Answer / manish yadav

echo hi praveen how are you|sed 's/ [a-z]/\U&/g'|sed 's/^[a-
z]/\U&/g'

Is This Answer Correct ?    9 Yes 11 No

How u convert string "hi pravin how are you?" to "Hi Pravin How Are You?" ..

Answer / pravin

Dear amlan Iwant answer which work for any string given.

Is This Answer Correct ?    7 Yes 13 No

How u convert string "hi pravin how are you?" to "Hi Pravin How Are You?" ..

Answer / sonia

Use perl :-)

msg="hi praveen how are you"
msg=`echo $msg | perl -n -e 'print ucfirst(lc);'`

Is This Answer Correct ?    4 Yes 10 No

How u convert string "hi pravin how are you?" to "Hi Pravin How Are You?" ..

Answer / manuswami

echo "hi praveen how are you"|sed -e 's/
[a-z]/\U&/g'\;'s/^[a-z]/\U&/g'

Is This Answer Correct ?    9 Yes 16 No

How u convert string "hi pravin how are you?" to "Hi Pravin How Are You?" ..

Answer / amlan

sed 's/hi pravin how are you?/Hi Pravin How Are You?/g'
filename

Is This Answer Correct ?    15 Yes 26 No

Post New Answer

More Shell Script Interview Questions

How can we find the process name from its process id?

0 Answers  


How do I edit a .sh file?

0 Answers  


Can shell script run on windows?

0 Answers  


In a file , how to retrieve the lines which are the multiples of 50 ? like 50,100,150th lines etc.

9 Answers   Amazon,


What can you do with powershell?

0 Answers  


What is the default ubuntu terminal?

0 Answers  


How do I run a bin bash script?

0 Answers  


Give some situations where typing error can destroy a program?

0 Answers  


When should shell programming/scripting not be used?

0 Answers  


I Forgot My Windows Vista Password! How Can I Find My Windows Lost Password?

1 Answers  


I want to connect to a remote server and execute some commands, how can I achieve this?

0 Answers  


What is the fastest scripting language?

0 Answers  


Categories