Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > pattern matching

Reply
Thread Tools

pattern matching

 
 
pavan734@gmail.com
Guest
Posts: n/a
 
      04-20-2006
hi Iam pavan . I need to run a perl script that runs on a file and does
the following.

The file may look like like this
pavan.h:

pavan_here hi how r u
pavan_there Iam fine
pavan_now typing

Search for words containing pavan(say)
In the above example it much search for pavan_here, pavan_there ,
pavan_now and modify those words such that
1.underscores must be eliminated
2. Next letter to underscore(i.e anyletter after underscore) must
become capital.


I mean to say when I run the script the file must modify to

pavanHere hi how r u
pavanThere Iam fine
pavanNow typing

Hope you understood the problem

 
Reply With Quote
 
 
 
 
Jürgen Exner
Guest
Posts: n/a
 
      04-20-2006
http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:
> hi Iam pavan . I need to run a perl script


If your system is set up properly then you can run a perl script simply by
typing it's name on the command line.
If that is not your problem then we will need much more details about your
system and how exactly you are trying to run the script.

> that runs on a file and
> does the following.
>
> The file may look like like this
> pavan.h:
>
> pavan_here hi how r u
> pavan_there Iam fine
> pavan_now typing
>
> Search for words containing pavan(say)
> In the above example it much search for pavan_here, pavan_there ,
> pavan_now and modify those words


To modify text people often use the 's' (aka substitute) function

> such that
> 1.underscores must be eliminated


This could also be done by the 'tr' function

> 2. Next letter to underscore(i.e anyletter after underscore) must
> become capital.


The easiest way is probably to use the 'ucfirst' function.

> I mean to say when I run the script the file must modify to
>
> pavanHere hi how r u
> pavanThere Iam fine
> pavanNow typing
>
> Hope you understood the problem


I understand your goal (at least I think), that was a good description.
But you didn't explain what your problem is nor did you give us enough
information to fix it. Where are you stuck? Which part of your program is
not working as expected? Where is your program to begin with?

jue


 
Reply With Quote
 
 
 
 
pavan734@gmail.com
Guest
Posts: n/a
 
      04-20-2006
Sorry, I have not written any script at all. I know how to run a
script. But I want a code to do that. Also tell me whether is it
possible in vim "search and replace" command.

 
Reply With Quote
 
A. Sinan Unur
Guest
Posts: n/a
 
      04-20-2006
(E-Mail Removed) wrote in news:1145542973.014914.65260
@z34g2000cwc.googlegroups.com:

> Sorry, I have not written any script at all.


Please read the posting guidelines for this group, and then write a
script that attempts to accomplish what you want.

Then, come back here and ask about issues you can't solve.

> I know how to run a script. But I want a code to do that.


I think the going consulting rate here is about $100. Unfortunately,
most of us have really busy schedules, which means we can't take on new
clients all the time.

This is not a "write my code for me" service.

> Also tell me whether is it
> possible in vim "search and replace" command.


comp.editors

Sinan
--
A. Sinan Unur <(E-Mail Removed)>
(remove .invalid and reverse each component for email address)

comp.lang.perl.misc guidelines on the WWW:
http://augustmail.com/~tadmc/clpmisc...uidelines.html

 
Reply With Quote
 
pavan734@gmail.com
Guest
Posts: n/a
 
      04-20-2006
This is a generic question ...... A single vim command can do it. But I
dont know much abt vim.

 
Reply With Quote
 
A. Sinan Unur
Guest
Posts: n/a
 
      04-20-2006
(E-Mail Removed) wrote in news:1145544839.833962.38220
@g10g2000cwb.googlegroups.com:

> This is a generic question ...... A single vim command can do it. But I
> dont know much abt vim.


Then learn. On your own or with the help of the friendly people over in
comp.editors.

I won't be seeing your posts again.

Sinan

--
A. Sinan Unur <(E-Mail Removed)>
(remove .invalid and reverse each component for email address)

comp.lang.perl.misc guidelines on the WWW:
http://augustmail.com/~tadmc/clpmisc...uidelines.html

 
Reply With Quote
 
Jürgen Exner
Guest
Posts: n/a
 
      04-20-2006
(E-Mail Removed) wrote:
[What are you replying to? Please quote appropriatly -as has been customary
in Usenet for 2 decades- such that people have a chance to know what your
are talking about.]

> Sorry, I have not written any script at all.


No problem. Now is as good a time to start as any. I recommend "Learning
Perl", availaible in your favourite book store.

> I know how to run a
> script.


Good.

> But I want a code to do that.


Trying to understand: you want to run your script from your code? Please see
"perldoc -f system".

> Also tell me whether is it
> possible in vim "search and replace" command.


Maybe you should ask in a NG that deals with vim about if it is possible to
run a script in the vim "search and replace" command.

jue


 
Reply With Quote
 
Xicheng Jia
Guest
Posts: n/a
 
      04-20-2006
(E-Mail Removed) wrote:
> This is a generic question ...... A single vim command can do it. But I
> dont know much abt vim.


see your posts at comp.unix.shell

Xicheng

 
Reply With Quote
 
Jürgen Exner
Guest
Posts: n/a
 
      04-20-2006
(E-Mail Removed) wrote:
> This is a generic question ...... A single vim command can do it. But
> I dont know much abt vim.


What is a generic question? I don't see any in your post.

jue


 
Reply With Quote
 
robic0
Guest
Posts: n/a
 
      04-20-2006
On Thu, 20 Apr 2006 14:45:42 GMT, "A. Sinan Unur" <(E-Mail Removed)> wrote:

>(E-Mail Removed) wrote in news:1145542973.014914.65260
>@z34g2000cwc.googlegroups.com:
>
>> Sorry, I have not written any script at all.

>
>Please read the posting guidelines for this group, and then write a
>script that attempts to accomplish what you want.
>
>Then, come back here and ask about issues you can't solve.
>
>> I know how to run a script. But I want a code to do that.

>
>I think the going consulting rate here is about $100. Unfortunately,
>most of us have really busy schedules, which means we can't take on new
>clients all the time.


HUH? 100? Per hour? Where can I get that kind of work?

 
Reply With Quote
 
 
 
Reply

Thread Tools

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 Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with Pattern matching. Matching multiple lines from while reading from a file. Bobby Chamness Perl Misc 2 05-03-2007 06:02 PM
Matching neighbouring words of a pattern using Regex CV Perl 2 08-31-2004 12:27 AM
Pattern matching : not matching problem Marc Bissonnette Perl Misc 9 01-13-2004 05:52 PM
Pattern matching help! grep emails from file! danpres2k Perl 3 08-25-2003 02:47 PM
A newbie question on pattern matching DelphiDude Perl 3 07-26-2003 12:54 PM



Advertisments