Sponsored Content
Top Forums Shell Programming and Scripting Perl - Title Case after apostrophe Post 302395027 by gaurav1086 on Sunday 14th of February 2010 11:37:06 AM
Old 02-14-2010
Hello,

Try this
Code:
gaurav@localhost:~$ perl -wlp -e 's/(\S+)/\u\L$1/g;' <<< "Bob's gone to market"
Bob's Gone To Market
gaurav@localhost:~$

Regards,
Gaurav.
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Shell script to convert to Title case

I need a shell script which will convert the given string to Title case. E.g "hi man" to "Hi man" (5 Replies)
Discussion started by: SankarV
5 Replies

2. UNIX for Dummies Questions & Answers

Perl - converting selected characters to upper/lower case

Using STDIN, how can I use perl to take an input string, with all lower case letters in the first five characters, and convert them to uppercase... then take all uppercase letters in the second five characters and convert them to lowercase. Example: MichaelSmith to michaELSMIth Thank you! (2 Replies)
Discussion started by: doubleminus
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

Perl index function ignore case

Hi, Is there any way of ignoring case in Perl's index function? Thanks. (2 Replies)
Discussion started by: King Nothing
2 Replies

5. Shell Programming and Scripting

PERL - traverse sub directories and get test case results

Hello, I need help in creating a PERL script for parsing test result files to get the results (pass or fail). Each test case execution generates a directory with few files among which we are interested in .result file. Lets say Testing is home directory. If i executed 2 test cases. It will... (4 Replies)
Discussion started by: ravi.videla
4 Replies

6. Shell Programming and Scripting

Replace apostrophe with backslash apostrophe

I'm coding using BASH and have a requirement to replace apostrophes with backslash apostrophes. For example below: I am here 'in my room' ok Would be changed to: I am here /'in my room/' ok The original text is coming from a field in a MySql database and is being used by another process that... (5 Replies)
Discussion started by: dbjock
5 Replies

7. Shell Programming and Scripting

Making case insensitive perl statement

cat > tble blah blah blah sdfsdf dsdf sdf .d.f ..df .. sdf.. create table NextID ( id int auto_increment, zoneID int, entityName varchar(64), nextID int, lastModified TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, primary... (6 Replies)
Discussion started by: vivek d r
6 Replies

8. Shell Programming and Scripting

Perl title help

my codeothers (1 Reply)
Discussion started by: sauravrout
1 Replies

9. 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

10. 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
KinoSearch1::Analysis::Tokenizer(3pm)			User Contributed Perl Documentation		     KinoSearch1::Analysis::Tokenizer(3pm)

NAME
KinoSearch1::Analysis::Tokenizer - customizable tokenizing SYNOPSIS
my $whitespace_tokenizer = KinoSearch1::Analysis::Tokenizer->new( token_re => qr/S+/, ); # or... my $word_char_tokenizer = KinoSearch1::Analysis::Tokenizer->new( token_re => qr/w+/, ); # or... my $apostrophising_tokenizer = KinoSearch1::Analysis::Tokenizer->new; # then... once you have a tokenizer, put it into a PolyAnalyzer my $polyanalyzer = KinoSearch1::Analysis::PolyAnalyzer->new( analyzers => [ $lc_normalizer, $word_char_tokenizer, $stemmer ], ); DESCRIPTION
Generically, "tokenizing" is a process of breaking up a string into an array of "tokens". # before: my $string = "three blind mice"; # after: @tokens = qw( three blind mice ); KinoSearch1::Analysis::Tokenizer decides where it should break up the text based on the value of "token_re". # before: my $string = "Eats, Shoots and Leaves."; # tokenized by $whitespace_tokenizer @tokens = qw( Eats, Shoots and Leaves. ); # tokenized by $word_char_tokenizer @tokens = qw( Eats Shoots and Leaves ); METHODS
new # match "O'Henry" as well as "Henry" and "it's" as well as "it" my $token_re = qr/  # start with a word boundary w+ # Match word chars. (?: # Group, but don't capture... 'w+ # ... an apostrophe plus word chars. )? # Matching the apostrophe group is optional.  # end with a word boundary /xsm; my $tokenizer = KinoSearch1::Analysis::Tokenizer->new( token_re => $token_re, # default: what you see above ); Constructor. Takes one hash style parameter. o token_re - must be a pre-compiled regular expression matching one token. COPYRIGHT
Copyright 2005-2010 Marvin Humphrey LICENSE, DISCLAIMER, BUGS, etc. See KinoSearch1 version 1.00. perl v5.14.2 2011-11-15 KinoSearch1::Analysis::Tokenizer(3pm)
All times are GMT -4. The time now is 05:24 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy