Question

In: Computer Science

Email 1 Subject: Awk Utility Assessment 1 File: awk-utility-assessment-1.awk Create awk commands to remove all occurrences...


Email 1
Subject: Awk Utility Assessment 1
File: awk-utility-assessment-1.awk
Create awk commands to remove all occurrences of the word "PCC" from the input
stream. Your output should be a copy of each input line, with the word PCC
removed wherever it occurs.
      
Email 2
Subject: Awk Utility Assessment 2
File: awk-utility-assessment-2.awk
Create awk commands to remove the first and last words from each line of the
input (assume all lines contain 3 or more words). Your output should be a
copy of each input line, with the first and last words removed.

Email 3
Subject: Awk Utility Assessment 3
File: awk-utility-assessment-3.awk
Create awk commands to count the number of digits in the input.
Your output should be a single number.

Email 4
Subject: Awk Utility Assessment 4
File: awk-utility-assessment-4.awk
Create awk commands to calculate the sum of all digits in the input.
For example, if the input contains the number 123 in the first line,
and the number 456 in the last line, the output should be 21.
Your output should be a single number.

Solutions

Expert Solution

Answer 1
************

echo "hello PCC PCC" | awk -F" " '{NF=1} 1' OFS="PCC"

Answer 2
************

echo "hello PCC PCC" | awk '{ $1=" "}1 { $3=" "} 3'

Answer 3
************

Answer 4
*************

echo 123 456 | awk -F '' '{ sum = 0; for(i=1; i<=NF; i++) sum += $i; print "sum " sum }'

if you have any doubt then please ask me without any hesitation in the comment section below , if you like my answer then please thumbs up for the answer , before giving thumbs down please discuss the question it may possible that we may understand the question different way and we can edit and change the answers if you argue, thanks :)


Related Solutions

Create by using Linux server • Create a file name it foo.txt • Remove all permissions...
Create by using Linux server • Create a file name it foo.txt • Remove all permissions from foo.txt • What happen if you try to read the file? • Change foo.txt permission to read and write only for owner • Change foo.txt permission to read for group • Change foo.txt permission to read and write everyone
Permissions– commands and options Provide commands with screenshots. (a) Create a new file in the root...
Permissions– commands and options Provide commands with screenshots. (a) Create a new file in the root directory. What is the default permission for this file? (b) Set the directory permission to 400. What does it mean? (c) Set the directory permission to 100. What does it mean? (d) Set the directory permission to 200. What does it mean?
Task 1: Getting familiar with Unix commands Questions: How do you remove a directory and all...
Task 1: Getting familiar with Unix commands Questions: How do you remove a directory and all of its contents, including any subdirectories and files, without using rmdir repeatedly?         [5 Points] Go to your home directory (i.e. /home/) and enter the following command: ls -ali Explain the output. You need to clearly what each column specifies, what are the values in each column means. Also explain how it is different from: ls -li    [5 Points] How will you copy directory (not...
Create a bash script file named assessment-script-a that: 1. Accepts any number of file names on...
Create a bash script file named assessment-script-a that: 1. Accepts any number of file names on the command line 2. For each file name provided, delete any line that contains the string: qwe.rty When the changes are completed, the script should display the total number of files scanned, and the total number of files changed. Example Command: assessment-script-a file.a file.b file.c file.d file.e    Example Output: 5 files scanned, 3 files changed 3. Your script should include a series of...
1.AWK a public trade water utility company, has a Beta of .24. the most recent 10...
1.AWK a public trade water utility company, has a Beta of .24. the most recent 10 year treasury yield is 3.15%. what is the required rate of return on this company? Please use historical average market premium to answer the question. 2.suppose AWK paid $2 dividend in the past 12 month and its dividend is supposed to grow at 2% per year for ever. what would be a reasonable estimate of AWK's stock price based on the dividend discount model?...
I just want a draft for all these 3 email.which require ( TO,FROM,Subject line,email and signature)all...
I just want a draft for all these 3 email.which require ( TO,FROM,Subject line,email and signature)all of them are just imaginary whichever you like to mention on this email.Thanks Is the subject line as clear as it can be? Does it pass the alert/scan test? What is the call to action? Are the recipients clear on what they need to do or follow up on? Do you have a COMPLETE email signature with name, title, contact info? You are going...
Create a Word file containing the following: The full name of the “test subject” The test...
Create a Word file containing the following: The full name of the “test subject” The test subject is a person, not yourself, who can say the names of the products. The best test subject is one who is adamant about being an expert who can distinguish brand A from B. You cannot be the test subject because you generate the sequence, and the test subject cannot see it for an unbiased test. Pets and babies are not allowed as they...
1) a. Write a C++ program for the recursive algorithm that removes all occurrences of a...
1) a. Write a C++ program for the recursive algorithm that removes all occurrences of a specific character from a string b. Write the pseudocode for the program.
Linux Ubuntu 1. Use the appropriate commands to locate the device file used by the device,...
Linux Ubuntu 1. Use the appropriate commands to locate the device file used by the device, mount the filesystem to a directory of your choice, and check the filesystem for errors. 2. Finally, add a line to /etc/fstab to ensure that the filesystem can be easily mounted in the future (this line should not automount the filesystem at boot time). You have to document all your steps and provide the screenshot of your work process.
PHP Question - Subject: PHP File Handling and Uploads INSTRUCTIONS: Objective: • Create a sticky HTML...
PHP Question - Subject: PHP File Handling and Uploads INSTRUCTIONS: Objective: • Create a sticky HTML form. • Submit form for processing. • Sanitize and validate form data. • Upload a profile image. • Add a record to a text file. • Display form results with content from another text file and the uploaded image. Description: This assignment deals with file management. It requires the use of 3 new files and 1 new directory. You will create the new file-uploads.php...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT