Lab 7 is the first and simplest Perl script that filters data presented on STDIN, changing...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
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 (<STDIN>)" 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: 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 (<STDIN>)" 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:
Expert Answer:
Answer rating: 100% (QA)
Answer usrbinperl if ARGV 2 print Usage 0 FROM STRING TO STRING ... View the full answer
Related Book For
Probability and Random Processes With Applications to Signal Processing and Communications
ISBN: 978-0123869814
2nd edition
Authors: Scott Miller, Donald Childers
Posted Date:
Students also viewed these accounting questions
-
The input to a linear filter is a random process with the following autocorrelation function: The impulse response of the filter is of the same form and is Determine the autocorrelation function of...
-
Data on the number of occurrences per time period and observed frequencies follow. Use = .05 and the goodness of fit test to see whether the data fit a Poisson distribution. Number of Occurrences...
-
Lines on an organization chart can be solid, to reflect a direct reporting relationship, or dotted, to reflect an indirect reporting relationship to another manager. For example, in the human...
-
Suppose that in a wave of pessimism, housing prices fall by 10% across the entire economy. a. Has the stock of real assets of the economy changed? b. Are individuals less wealthy? c. Can you...
-
Early in 2013 the Bicycle Messenger Service Corpo-ration ( BMSC) purchased a multiline/ multifunction telephone system at a cost of $ 50,000. At that time, BMSC estimated that the system had a useful...
-
Briefly describe the importance of people change management in BPM activities.
-
Recall, a party served with a request to produce usually must respond within 30 days of service of the request. Further investigate CCP 2031.210-2031.320, which governs responses to requests to...
-
The following information is available for the preparation of the governmentwide financial statements for the city of Northern Pines for the year ended June 30, 2012: Expenses: General government...
-
Suppose that a firm has an expected return of 8.3% and a variance on the return of 0.0176. Assume the risk-free rate is 2.1%. What is the standard deviation on the return? a) 10.0% b)13.3% c)7.9% d)...
-
1. Is Jones correct? That is, using the more complete data set, is it true that Jones has the lowest defect rate overall? Are Joness percentages correct overall (i.e., combining domestic and overseas...
-
Individual A owned appreciated property that Y Corporation wished to acquire for use in its business. To accomplish the transaction, a new corporation, Jones, was organized by Y transferring all of...
-
Now that you have considered how a law can increase the productivity of innovation and physical capital, address the following: Describe 3 other examples of economic concentration. What are the risks...
-
Susan is purchasing an acreage tract of farmland that she is certain will go commercial in the near future. She will pay $10,000 for the tract today and hopes to sell it for $25,000 in eight years....
-
Doede Corporation uses activity-based costing to compute product margins. In the first stage, the activity-based costing system allocates two overhead accounts-equipment depreciation and supervisory...
-
Given an instance of the Athlete class called athlete, what is the proper way to set the value of the jersey number after it has been instantiated? public class Athlete { private String first_name;...
-
Packaging Solutions Corporation manufactures and sells a wide variety of packaging products. Performance reports are prepared monthly for each department. The planning budget and flexible budget for...
-
A department store offers the following credit terms on a new appliance "slashed" to a price of $300: only $100 down, and the balance in 24 monthly installments of $12.50. What monthly rate of...
-
In your readings, there were many examples given for nurturing close family relationships in this ever-evolving technological society we live in Based upon your readings and research describe three...
-
For the joint CDF that is the product of two marginal CDFs, Fx,y (x, y) = Fx (x) Fy, as described in Exercise 5.4, show that the events {a < X < b}and {c < Y < d} are always independent for any...
-
Show that the estimator for the autocorrelation function, XX (), described in Equation (10.26) is unbiased. That is, show that E [XX ()] = RXX ().
-
Suppose a zero- mean Gaussian random process, X (t), has a PSD given by Where fo = 1. We desire to simulate a 5- ms segment of this process sampled at a rate of 2 kHz. Therefore, 10 samples will need...
-
The box frame is subjected to a uniform distributed loading \(w\) along each of its sides. Determine the moment developed in each corner. Neglect the deflection due to axial load. EI is constant. E A...
-
Using a job board on the Web, list and briefly describe five positions in your field in your state. What skills, experience, and background does each position require? What is the salary range for...
-
As the manager of an electronics retail store, you guarantee that you will not be undersold. If a customer finds another retailer selling the same equipment at a lower price within one month of his...
Study smarter with the SolutionInn App