Explore BrainMass
Share

Explore BrainMass

    Perl scripts for file processing

    This content was COPIED 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 9, 2019, 10:57 pm 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