File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Perl and the fly likes perl  String find and replace - count ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Languages » Perl
Bookmark "perl  String find and replace - count ?" Watch "perl  String find and replace - count ?" New topic
Author

perl String find and replace - count ?

kri shan
Ranch Hand

Joined: Apr 08, 2004
Posts: 1368
perl -pi -e 's/sample1/sample2/g' *.* replaces string value sample1 with sample2 globally. How do i add count (number of times sample1 string replaced) ?
fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 10916
    
  12

perlmonks is always a great place to search. I found this, which appears to be your exact question.


There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: perl String find and replace - count ?
 
Similar Threads
script for help
shift question
Single type import error.
Is it possible to call a action of one war file from action of another war file?
Help In displaying properties of objects contained in ArrayList