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...
Project 6-1: Email Creator C++ code Create a program that reads a file and creates a...
Project 6-1: Email Creator C++ code Create a program that reads a file and creates a series of emails. Console Email Creator ================================================================ To:      [email protected] From:    [email protected] Subject: Deals! Hi James, We've got some great deals for you. Check our website! ================================================================ To:      [email protected] From:    [email protected] Subject: Deals! Hi Josephine, We've got some great deals for you. Check our website! ================================================================ To:      [email protected] From:    [email protected] Subject: Deals! Hi Art, We've got some great deals for you. Check our website! Specifications...
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.
Create 1 HTML page and 1 CSS file for all the styles. Your html page will...
Create 1 HTML page and 1 CSS file for all the styles. Your html page will be a small gallery of images using the Polaroid style. The page should have at least 1 row of 3 images. You can choose any theme of images. Don't pick random images, make them all have a theme. Add an h1 tag for the header of your page. Style the h1 tag with a color, size, and font family. Include a paragraph tag under...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT