What is the purpose of the $nterms variable? Refer to the PERL script shown in Figures 8.1
Question:
What is the purpose of the $nterms variable?
Refer to the PERL script shown in Figures 8.1 and 8.2.
Transcribed Image Text:
C:\Users ex h\Documents\Book SearchForTerms.prl - Notepad++ File Edit Search View Encoding Language Settings Macro Run Plugins Window? *O 510 SearchForTerms pr 13 #Sample program to scan file for a list of matching terms; #write records with matches to an output file for later import to a database 2 3 6 7 8 9 10 11 12 13 14 15 16 # 28 29 30 31 32 use TIME::Local; #open the file containing a list of terms of interest and load #them into an array; offset for first row = 0 $infile= "mysearchterms.txt"; open (IN, Sinfile) or die "Couldn't open input file $infile "; Sterma= 0; while ($input = ) ( chomp ($input); $searchterms [Si] $input; $nterms++; } close (IN); $set a flag for first output record Smatch="n"; identify the file to be searched 17 18 19 $infile="SystemLog.txt"; 20 #identify the output file for records that match search terms 21 Soutfile="Output/SystemLogMatches.txt"; 22 #open and process the input file 23 open (IN, Sinfile) or die "Can't open input file $input "; 24 $num=0; 25 while ($input = ) [ 26 chomp ($input); 27 #this sample file contains non-printable characters; remove them $input = /[\x7E-\xFF]//g; $num++; for ($i=0; $i < $nterms; $i++) { if ($input = /Ssearchterms [Si]/) ( #found a match Norm length: 1,381 lines: 47 Ln: 1 Col: 59 Sel: 010 Windows (CRLF) UTF-8 0 FIGURE 8.1 First part of script to search file based on search terms. X INS
Fantastic news! We've Found the answer you've been seeking!
Step by Step Answer:
Answer rating: 50% (2 reviews)
It gives the number of ...View the full answer
Answered By
Branice Buyengo Ajevi
I have been teaching for the last 5 years which has strengthened my interaction with students of different level.
4.30+
1+ Reviews
10+ Question Solved
Related Book For
Question Posted:
Students also viewed these Computer science questions
-
According to Leadership Development Intervention by Jay Conger what are the pros and cons of individual skill development, socialization of the corporate vision and values, strategic interventions...
-
What is the purpose of the $match variable? Refer to the PERL script shown in Figures 8.1 and 8.2. C:\Users ex h\Documents\Book SearchForTerms.prl - Notepad++ File Edit Search View Encoding Language...
-
In line 42, what is the purpose of the \ character? Refer to the PERL script shown in Figures 8.3 and 8.4. C:\Users ex_h\Documents\Book\SQLServerLogCheck.prl - Notepad+. Eile Edit Search View...
-
Using quarterly data for 10 years, the regression results are given in the following table where CAR = number of new car sales per thousand population, PRICE = new car price index, INC= per-capita...
-
Do service-sector companies have inventoriable costs? Explain.
-
On July 1, 2008, Agincourt Inc. made two sales. 1. It sold land having a fair market value of $700,000 in exchange for a 4-year zero-interest-bearing promissory note in the face amount of $1,101,460....
-
The sequential process of budget variance analysis involving increasing detail from levels 0 through 3. LO.1
-
Marion Company is an 80% owned subsidiary of Lange Company. The interest in Marion is purchased on January 1, 2015, for $680,000 cash. The fair value of the NCI was $170,000. At that date, Marion has...
-
Calculate the arithmetic average for Ww Portfolio: Year Return 1 0.03 2 0.23 3 0.11 4 0.27 5 0.21 Enter the answer with 4 decimals, e.g. 0.1234.
-
What records are written to the Out file? Refer to the PERL script shown in Figures 8.1 and 8.2. C:\Users rex h\Documents\Book SearchForTerms.pri- Notepad++ File Edit Search View Encoding Language...
-
As the logical data model is developed, should any significant usage requirements be noted or documented? Why or why not? You are asked to lead a design team for a new database to be used by your...
-
A comment is made in the paragraph that follows Equation 7.14 suggesting the selection of the radius of influence (r0) is somewhat arbitrary (i.e., the discharge is not overly sensitive to this...
-
Alec is an employee who drives a 2021 Ford C-Max with a fair-market value of $32,000. He has been given the choice to have the fringe benefit reported on his W-2 either using the lease-value rule or...
-
What resource do most thinking and learning technologies rely on to be effective? a) data b) images c) gas d) robots
-
Financial Reporting Problem Marks and Spencer plc (M&S) The financial statements of M&S (GBR) are presented in Appendix A. The companys complete annual report, including the notes to the...
-
Totally Chemical is considering an investment decision project in which the organization expands into the trucking business. Totally Chemical wants to begin this investment decision project by buying...
-
Presented below is the balance sheet of Sandhill Corporation as of December 31, 2017. SANDHILL CORPORATION BALANCE SHEET DECEMBER 31, 2017 Goodwill (Note 2) Buildings (Note 1) Inventory Land Accounts...
-
A classmate says, "A weak-field ligand usually means the complex is high spin." Is your classmate correct? Explain.
-
Synthesize the products by drawing out reagents and intermediates along the way. `N H. OH HO HO
-
Given a sequence S of n values, each equal to 0 or 1, describe an in-place method for sorting S.
-
Suppose S is a sequence of n values, each equal to 0 or 1. How long will it take to sort S stably with the bucket-sort algorithm?
-
Suppose S is a sequence of n values, each equal to 0 or 1. How long will it take to sort S with the merge-sort algorithm? What about quick-sort?
-
ACC 2 0 2 Milestone One: Operational Costs Data Appendix You plan to open a small business for manufacturing pet collars, leashes, and harnesses. You have found a workshop space you can use for...
-
Explain the following: Understand the PPE acquisition (or investing) cycle and related significant transactions and source documents Understand the relevant assertions/objectives about PPE balances...
-
Problem 3 Progress Company acquired 6 0 % of Stall Corporation on 1 2 0 2 0 . Fair values of Stall's assets and liabilities approximated book values on that date. Progress uses the initial value...
Study smarter with the SolutionInn App