CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Need a Custom or Prewritten Perl Program?: I need a program that...:
Reads a file and uses regular expressions to modify file.

 



Jojoma
New User

Mar 7, 2007, 5:04 PM

Post #1 of 2 (1428 views)
Reads a file and uses regular expressions to modify file. Can't Post

Hi guys, I need a perl script that does the following.

1. Reads the attached file dog.txt as either a here document or as input via a file handel on STDIN

2. Incorporates regular expressions to

A. Stop out all excess spaces, leaving a single space between each word.

B. Search for the pattern (space) I (space) Thats a capital I and a space on each side. Count all instances of this pattern, return thetotal number of instances, and print this output to a file called patterns.txt. supported by text similar to "The pattern _I_ was found x times."

C. Output all text enclosed in quotes into a separate (second) file called quotes.txt

D. Print the output to a separate (third) text file named out.txt

Thanks for any help. :)
Attachments: dog.txt (1.66 KB)


KevinR
Veteran


Mar 7, 2007, 7:16 PM

Post #2 of 2 (1424 views)
Re: [Jojoma] Reads a file and uses regular expressions to modify file. [In reply to] Can't Post

if you searched on google you could pobably find some code as I have seen this exact or nearly exact same question a few times over the years. I assume it's school/class work.
-------------------------------------------------

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives