Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Lab 7 is the first and simplest Perl script that filters data presented on STDIN, changing all occurrences of one string to another and

  

Lab 7 is the first and simplest Perl script that filters data presented on STDIN, changing all occurrences of one string to another and outputting all input lines, changed and unchanged to STDOUT. FROMSTRING and TOSTRING can be PERL-compatible regular expressions. Requirements Your Python script shall be named -/cs3030/lab7/filter.pl and be marked executable. Usage: ./filter.pl FROMSTRING' TOSTRING' Your script should read only from STDIN and write only to STDOUT. Write error messages only to STDERR. Your script should support regular expressions and be capable of changing all occurrences of the FROMSTRING to TOSTRING. All lines are output, both changed and unchanged. Exit(0) if there are no errors. It is ok for nothing on the input to be changed as they are output. Issue a Usage message and exit(1) if there are not exactly two commandline parameters provided. Helpful Hints Use /usr/bin/perl on icarus. use "while ( )" to read each line of input Use $_ to access each line read use "s///" (the substitution operator) to change all occurrences of FROMSTRING to TOSTRING on each line Use print to output all line on STDIN to STDOUT, whether or not the line was changed $ARGV[] contains the commandline arguments. $ARGV[0] is the first argument $#ARGV is the index of the last item in $ARGV Run cucumber to determine your grade tar xvf /var/classes/cs3030/1lab7/cuke.tar ./cucumber -s Files For this lab you will have created folder lab7 and the following executable files:

Step by Step Solution

3.42 Rating (149 Votes )

There are 3 Steps involved in it

Step: 1

Answer usrbinperl if ARGV 2 print Usage 0 FROM STRING TO STRING ... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Probability and Random Processes With Applications to Signal Processing and Communications

Authors: Scott Miller, Donald Childers

2nd edition

123869811, 978-0121726515, 121726517, 978-0130200716, 978-0123869814

More Books

Students also viewed these Accounting questions

Question

Describe the goal of cognitive psychotherapy.

Answered: 1 week ago