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...
-
Which of the following groups constitute controlled groups? (Any stock not listed below is held by unrelated individuals each owning less than 1% of the outstanding stock.) For brother-sister...
-
Consider an economy that initially has a labour force of 2000 workers. Of these workers, 1900 are employed and each works 40 hours per week. Ten units of output are produced by each hour of labour....
-
Design a decision tree that enables you to identify an item from a category in which you are interested (e.g., cars, animals, pop singers, films, etc.).
-
The income statement of Goliath Industries Inc. for the current year ended June 30 is as follows: Changes in the balances of selected accounts from the beginning to the end of the current year are as...
-
The accounts in the ledger of Devers Gym as of August 31 are listed in alphabetical order as follows. All accounts have normal balances. The balance of the cash account has been omitted. Prepare an...
-
All the following case study questions are based on this book: Project management achieving competitive advantage by Jeffrey K. Pinto Question 8.1 1. Given the history of large cost overruns...
-
Calculate the savings ratio using the following information: Liabilities = $25,000 Liquid assets = $5,000 Monthly credit payments = $800 Monthly savings = $760 Net worth = $75,000 Current liabilities...
-
Describe the nature and purpose of a long-arm statute.
-
Identify the primary ways of serving process.
-
The Airbus A380 was the worlds first doubledecker aircraft. It can accommodate from 555 to 853 passengers depending on the class configuration. Long haul airlines such as Singapore Airlines were...
-
Describe the nature and purpose of a complaint.
-
Finnish paper company M-real produced paper and packaging products, the demand for which is highly influenced by the demand for end consumer products. Global demand decreased due to the global...
-
Calculate this employee's gross compensation for each week of this biweekly pay period . The employer uses the weighted average of all rates used in the week . Week 1 Sun Mon Tues Wed Thurs Fri Sat...
-
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...
-
What would the QA/QC planning grid (see Figure 12. 6) look like for a project you have been involved in? Data from Figure 12. 6 Table 12.6 QA/QC planning grid, with examples Quality assurance...
-
Why is the definition of quality critical to the success and acceptance of a project?
-
What is the purpose of the Quality Management Plan?
Study smarter with the SolutionInn App