Explore BrainMass
Share

Perl scripts for file processing

This content was STOLEN from BrainMass.com - View the original, and get the already-completed solution here!

Write separate Perl scripts for each of the given requirements. Mentioned input data files are attached with this posting. In each case command to run the script from the command line should look like:

COMMAND_PROMPT> script_number.pl input_data_file.txt

[1] A script script_1.pl that replaces each instance of "th" with "TH" in file part1.txt. The script should print the file to the screen, not just the replaced lines.

[2] A script script_2.pl to look for lines in the file part2.txt containing a period, question mark, or comma at the end of the line. When these lines are found, print only the part of the line that occurs after the word "it" (case insensitive).

[3] A script script_3.pl that prints only words (not the entire line) in the file part3.txt on a word boundary that have the letter "p" or "P" in them (i.e. words begin/end with P/p).

© BrainMass Inc. brainmass.com October 25, 2018, 12:43 am ad1c9bdddf
https://brainmass.com/computer-science/perl/238400

Attachments

Solution Preview

You can implement the script in many ways. One such implementation of these three scripts is attached as 238400.zip. You can use ...

Solution Summary

Please ensure that part2.txt is saved with Unix style newline ending, else the corresponding script will not give the expected output.

$2.19
See Also This Related BrainMass Solution

Will you be able to write a 3-6 page paper on programming language "Perl"?

The objective of this assignment is to report on the features behind the design of a programming language. (Perl) Scripting language with extensive report generating facilities.
The report should follow standard formatting for technical reports. This includes a cover page, an introduction, a background section, as many sections needed to cover the relevant topics, a conclusion, and a list of references. The report is 3-6 page range.
The report should contain information on the following:
A short history of the language, including which languages it may have been based on and which languages it may have subsequently influenced. This may be part of the introduction or the background.
The main objective or feature of the language. Why was this language invented?
An evaluation of whether the language met its goals.
Any machine dependent characteristics of importance or interest.
Any syntactic or semantic details of interest. Show how the syntax or semantics is particularly suited (or not suited) to the objectives. DO NOT just list all of the syntax of the language. You are not trying to reproduce a language reference manual. For example, an if-statement is only interesting if it has unique syntax or semantics. On the other hand, the absence of a common syntactic structure like an if-statement is interesting to note.
For languages, interesting issues we have examined in class as general features of languages. For example, built-in types scoping rules, etc. Again, do not just list everything about the language. We are interested in the differences between languages. For example, what makes this language different from the languages we have already studied?
Finally, the report should conclude with a discussion of why you would or would not use this language. That is, give a 'personal opinion' to the features and capabilities of the language. It is perfectly acceptable to decide that you would never use the language.

View Full Posting Details