Sponsored Content
Top Forums UNIX for Advanced & Expert Users Shell script to convert to Title case Post 302122760 by anbu23 on Thursday 21st of June 2007 08:53:49 AM
Old 06-21-2007
Quote:
Originally Posted by SankarV
this is good but pls tell the logic in perl part.



also can it be done purely in shell script (+ awk, sed like tat) without any help from other languages like perl, python, etc?
Code:
echo "hi man" | perl -ane ' foreach $wrd ( @F ) { print ucfirst($wrd)." "; } print "\n" ; '

a option splits the input with space as separator and assign the splitted words in array F.
Loop through the array and ucfirst function capitalizes the first character of the word
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

lower case to upper case string conversion in shell script

How can convert a Lower case variable value to an upper case in the kron shell script. (3 Replies)
Discussion started by: dchalavadi
3 Replies

2. Shell Programming and Scripting

how to convert value in a variable from upper case to lower case

Hi, I have a variable $Ctrcd which contains country names in upper case and i want to convert them into lower case. I have tried so many solutions from already existing threads but couldn't get the correct one. Can anybody help me with this..... Thanks a lot.. (2 Replies)
Discussion started by: manmeet
2 Replies

3. Shell Programming and Scripting

Shell/Perl script to convert to Capitalize case

I need a shell script which will convert the given string within a <title> tag to Capitalize case. E.g "<title>hi man: check this out</title>" to "<title>Hi Man: Check This Out</title>" (11 Replies)
Discussion started by: parshant_bvcoe
11 Replies

4. Shell Programming and Scripting

convert upper case to lower case in ascript

I have a package to install and the installation script which does it . The files/directories names in the script are all lower case but the actual package has everything in upper case - file names, directories . I don't want to rename directories and files in the package - it has a lot of them . ... (2 Replies)
Discussion started by: vz6zz8
2 Replies

5. Shell Programming and Scripting

Script to Convert Upper case to Lower case

Hi All I have a script which extracts values from a Database (A persons name) and puts it into a variable in my script IE: $NAME However the Value in the DB is all in uppercase and contains the users first name and last name EG: > echo $NAME GRAHAM BOYLE > What I need is only the... (7 Replies)
Discussion started by: grahambo2005
7 Replies

6. Shell Programming and Scripting

Perl - Title Case after apostrophe

I've got: $string =~ s/(\w+)/\u\L$1/g; Which capitalizes each word in the string. The problem is if I have a string with an apostrophe the first letter after it gets capitalized as well. So Bob's becomes Bob'S. Thanks for any quick fixes! (4 Replies)
Discussion started by: mjmtaiwan
4 Replies

7. UNIX for Dummies Questions & Answers

To convert Lower case to Upper Case

There is a script where we pass the parameter in lower case: say: . ./scriptName pArameter #!/bin/ksh echo "`date` Entering $0 Reloading the $1 table " mname1=$1 (code to login MYSQL Database) Truncate table $mname1; exit ! Since now there is a limitaion of MYSQL that it accept... (5 Replies)
Discussion started by: ambarginni
5 Replies

8. UNIX for Advanced & Expert Users

Shell script to convert words to Title case

Hi :) I have a .txt file with thousands of words. I was wondering if i could use a simple sed or awk command to convert / replace all words in the text file to Title Case format ? Example: from: this is line one this is line two this is line three to desired output: This Is Line... (8 Replies)
Discussion started by: martinsmith
8 Replies

9. Shell Programming and Scripting

Convert text between exact matching patterns to Title case

Hi Folks, I have a large text file with multiple similar patterns on each line like: blank">PATTERN1 some word PATTERN2 title=">PATTERN1 some word PATTERN2 blank">PATTERN1 another word PATTERN2 title=">PATTERN1 another word PATTERN2 blank">PATTERN1 one more time PATTERN2 title=">PATTERN1... (10 Replies)
Discussion started by: martinsmith
10 Replies

10. Shell Programming and Scripting

Help need to convert bi-lingual files in sub-title format

I have a large number of files in the standard subtitle format with the additional proviso that the files are bi-lingual i.e. English and a second language: in this case Hindi. A small sample is given below: 00 04 07 08 00 04 11 00 I mean very high fever... He even vomited. 00 04 07 08 00... (6 Replies)
Discussion started by: gimley
6 Replies
TFBS::Matrix(3pm)					User Contributed Perl Documentation					 TFBS::Matrix(3pm)

NAME
TFBS::Matrix - base class for matrix patterns, containing methods common to all DESCRIPTION
TFBS::Matrix is a base class consisting of universal constructor called by its subclasses (TFBS::Matrix::*), and matrix manipulation methods that are independent of the matrix type. It is not meant to be instantiated itself. FEEDBACK
Please send bug reports and other comments to the author. AUTHOR - Boris Lenhard Boris Lenhard <Boris.Lenhard@cgb.ki.se> Modified by Eivind Valen eivind.valen@gmail.com APPENDIX
The rest of the documentation details each of the object methods. Internal methods are preceded with an underscore. matrix Title : matrix Usage : my $matrix = $pwm->matrix(); $pwm->matrix( [ [12, 3, 0, 0, 4, 0], [ 0, 0, 0,11, 7, 0], [ 0, 9,12, 0, 0, 0], [ 0, 0, 0, 1, 1,12] ]); Function: get/set for the matrix data Returns : a reference to 2D array of integers(PFM) or floats (ICM, PWM) Args : none for get; a four line string, reference to 2D array, or a 2D piddle for set pdl_matrix Title : pdl_matrix Usage : my $pdl = $pwm->pdl_matrix(); Function: access the PDL matrix used to store the actual matrix data directly Returns : a PDL object, aka a piddle Args : none revcom Title : revcom Usage : my $revcom_pfm = $pfm->revcom(); Function: create a matrix pattern object which is reverse complement of the current one Returns : a TFBS::Matrix::* object of the same type as the one the method acted upon Args : none rawprint Title : rawprint Usage : my $rawstring = $pfm->rawprint); Function: convert matrix data to a simple tab-separated format Returns : a four-line string of tab-separated integers or floats Args : none prettyprint Title : prettyprint Usage : my $prettystring = $pfm->prettyprint(); Function: convert matrix data to a human-readable string format Returns : a four-line string with nucleotides and aligned numbers Args : none length Title : length Usage : my $pattern_length = $pfm->length; Function: gets the pattern length in nucleotides (i.e. number of columns in the matrix) Returns : an integer Args : none randomize_columns Title : randomize_columns Usage : $pfm->randomize_columns(); Function: Randomizes the columns of a matrix Returns : Nothing Args : none perl v5.14.2 2008-01-24 TFBS::Matrix(3pm)
All times are GMT -4. The time now is 04:55 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy