Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

i need help with this perl assignment Lab 7 is the first and simplest Perl script that filters data presented on STDIN, changing all occurrences

i need help with this perl assignment

image text in transcribed

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. Your Python script shall be named ~/CS3030/lab7/filter. pi 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(l) if there are not exactly two command line parameters provided. 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 command line arguments. $ARGV[0] is the first argument $#ARGV is the index of the last item in $ARGV Run cucumber to determine your grade tar vf/var/classes/cs3030/lab7/cuke.tar ./cucumber -s Files For this lab you will have created folder lab7 and the following executable files: 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. Your Python script shall be named ~/CS3030/lab7/filter. pi 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(l) if there are not exactly two command line parameters provided. 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 command line arguments. $ARGV[0] is the first argument $#ARGV is the index of the last item in $ARGV Run cucumber to determine your grade tar vf/var/classes/cs3030/lab7/cuke.tar ./cucumber -s Files For this lab you will have created folder lab7 and the following executable files

Step by Step Solution

There are 3 Steps involved in it

Step: 1

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

More Books

Students also viewed these Databases questions