Answered step by step
Verified Expert Solution
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 ...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started