1. When passing variables to an awk script file; the -v option must be specified if you would like to access the variable in the post-processing section of your script. T/F
2.Which of the following is not true about awk arrays?
a.You do not need to formally declare an array; it is created automatically on first assignment
b.If an array element is accessed before it is assigned; the default value will be 0
c.A for loop can itterate over all indexes or keys in an array
d. Array elements can only be addressed using an index
3.Which of these is NOT true regarding awk?
a. Records are separated into fields using the contents of the FS variable
b. Data files are divided into records using the contents of the RS variable
c. The number of fields must remain constant between records
d. Awk can accept input from stdin
4. Which of the following arguments will allow configuring the field separator when running awk?
a. -F
b. --FS
c.f
d. -d
5. What is the default output field separator in awk?
a. underscore
b. space
c. comma
d. newline
Following is the answer:
1. When passing variables to an awk script file; the -v option
must be specified if you would like to access the variable in the
post-processing section of your script.
Answer: F
Because, -f is used
2.Which of the following is not true about awk arrays?
b.If an array element is accessed before it is assigned; the
default value will be 0
3.Which of these is NOT true regarding awk?
c. The number of fields must remain constant between records
4. Which of the following arguments will allow configuring the
field separator when running awk?
b. --FS
5. What is the default output field separator in awk?
b. space
1. When passing variables to an awk script file; the -v option must be specified if...
Write an awk script to print just the name and size of ordinary files (do not include directories), one on each line. The output must be aligned as shown in the example below. First, analyze a typical output of the ls -l command to see what differentiates an ordinary file from a directory and which fields contain the file name and size information. Then, determine what the field separator is and whether the default field separator of awk will work,...
In a new file located in the same package as the class Main, create a public Java class to represent a photograph that consists of a linear (not 2D) array of pixels. Each pixel is stored as an integer. The photograph class must have: (a) Two private fields to represent the information stored about the photograph. These are the array of integers and the date the photograph was taken (stored as a String). The values in the array must be...
The purpose of this assignment is to develop solutions that perform File IO and objects. Problem specifications are shown below with my changes in blue. 1. File Previewer Write a program that asks the user for the name of a text file. The program should display the first 10 lines of the file on the screen. If the file has fewer than 10 lines, the entire file should be displayed along with a message indicating the entire file has been...