Question

In: Computer Science

PLEASE ANSWER ALL OF THEM. Use the following file listing called intro.txt to answer the questions....

PLEASE ANSWER ALL OF THEM.

Use the following file listing called intro.txt to answer the questions.

Make sure to use regular expressions. Number your answers 1 through 7.

The Unix operating system was pioneered by Ken Thompson and Dennis Ritchie at Bell Laboratories in the late 1960s. One of the primary goals in the design of the Unix system was to create an environment that promoted efficient program development.

1-Write the grep command to output all lines that begin with an uppercase T.

2-Write the grep command to output all lines that end with a lowercase n.

3-Write the grep command to match and output all lines that have a lowercase p followed by any single character followed by a lowercase o.

4-Write the grep command to match and output all words that contain digits.

5-Write the grep command to match and output a sequence of alphabetic letters that is exactly 9 characters long.

6-Write a command using tr to remove all spaces (all the space characters) from intro.txt

7-Write a command using sed to remove all spaces (all the space characters) from intro.txt

Solutions

Expert Solution

#1-Write the grep command to output all lines that begin with an uppercase T.

> grep "^T" intro.txt

# '^' means start of string




#2-Write the grep command to output all lines that end with a lowercase n.

> grep "n$" intro.txt

# '$' means end of string




#3-Write the grep command to match and output all lines that have a lowercase p followed by any single character followed by a lowercase o.

> grep "p.o" intro.txt

#Here, '.' represents a single character





#4-Write the grep command to match and output all words that contain digits.

> grep -Po "\w*\d+\w*" intro.txt

#Here, "-P" stands for Perl regular expresions and -o gives output matched lines; "\d" is for digits in between any words \w*




#5-Write the grep command to match and output a sequence of alphabetic letters that is exactly 9 characters long.

> grep -Po "[a-zA-Z]{9}" intro.txt

#any case strings(a-z or A-Z) contain exactly 9 characters




#6-Write a command using tr to remove all spaces (all the space characters) from intro.txt

> tr -d ' ' < intro.txt

# 'tr -d' translate or delete characters here spaces deleted (' ')



#7-Write a command using sed to remove all spaces (all the space characters) from intro.txt

> sed 's/\s//g' intro.txt

# sed- stream editor, '\s' white space chacracters instead of space( ' ' ) and g is a global allow to delete both in between numbers and strings


Related Solutions

Please answer all the questions. Thank you Use the following data to answer the questions below:...
Please answer all the questions. Thank you Use the following data to answer the questions below: Column 1 Column 2 Column 3 Y in $ C in $ 0 500 500 850 1,000 1,200 1,500 1,550 2,000 1,900 2,500 2,250 3,000 2,600 What is mpc and mps? Compute mpc and mps. Assume investment equals $ 100, government spending equals $ 75, exports equal $ 50 and imports equal $ 35. Compute the aggregate expenditure in column 3. Draw a graph...
Load the regression data in the file called wagedata.csv and answer the following questions: (a) Create...
Load the regression data in the file called wagedata.csv and answer the following questions: (a) Create an interaction between Ability and PhD (b) Run a regression with the interaction a constant Ability and PhD. Write down you estimators and the t-statistics (c) Compute the difference-in-difference estimate and write down you answer. (d) Test if the difference is significant by showing relevant steps, and write down the conclusion to the test. Wage Ability Phd 3.52942833628898 2.57892317214096 1 11.5241044105103 0.217444617867018 1 6.43708200805673...
Please answer all questions Which of the following would be appropriate to use as an antiseptic?...
Please answer all questions Which of the following would be appropriate to use as an antiseptic? A. Ethanol B. Ultraviolet light C. Bleach D. Phenol If a piece of heat-sensitive medical equipment must be sterile to be used, which of the following methods would be the best method to achieve this? Autoclaving Ionizing radiation Ultraviolet light Bleach An antimicrobial substance that works by disrupting the plasma membrane would be ineffective in treating infections caused by: Enveloped animal viruses Prions Yeast...
please answer all 4 questions. i don't need a long answer. please explain them briefly and...
please answer all 4 questions. i don't need a long answer. please explain them briefly and correctly. Thank you in advance. 1. What does the term qualitative analysis mean? 2. The confirmatory reactions that identify nitrate and nitrite both produce brown NO2 gas. What criterion will you use to determine which anion produced the gas? 3. The confirmation reaction for the halides involves the addition of chlorine water. Describe how you will know which, if any, of the anions is...
Please answer all questions in Macroeconomics below, and answer them in detail and precisely. Question 5...
Please answer all questions in Macroeconomics below, and answer them in detail and precisely. Question 5 (Word limit 500 words) The world economy, in the last few months, has started to slow down due to many factors, such as trade wars, uncertainty over Brexit, and general slowdown in other economic activity. Assuming an economy starts initially at the full employment equilibrium, discuss (with the aid of aggregate output market and money market diagrams) the short run effect of a decrease...
Directions: Answer ALL of the following questions. Show ALL calculations and present them in a neat...
Directions: Answer ALL of the following questions. Show ALL calculations and present them in a neat and an orderly fashion. Credit will not be given for either unsupported answers or illegible answers. This is NOT a group assignment. Any indication of collaboration with your classmates will earn all involved a grade of zero (0). This assignment is due Monday, October 5, 2020. However, you may submit it before the due date. Late assignments are NOT accepted. The following is information...
Answer the following problems in an Excel file. Please upload only one Excel file with all...
Answer the following problems in an Excel file. Please upload only one Excel file with all of your answers, including #3 (which requires an explanation rather than a calculation). All problems must be solved using the PV and FV functions in Excel. If I deposit $8,000 in a bank account that pays interest of 1.5%, compounded annually, how much will I have in the account after 10 years? If I deposit $8,000 in a bank account that pays simple interest...
If possible, please answer all 4 questions. Thanks! :) 35. What file in the /proc directory...
If possible, please answer all 4 questions. Thanks! :) 35. What file in the /proc directory can be used to list the features supported by your system’s CPU? 36. Which of the following commands can be used to insert a kernel module into the Linux kernel? (Choose all that apply.) a. insmod b. modprobe c. lsmod d. depmod
Please use ONLY one Excel file to answer the below questions. ( including the formula using...
Please use ONLY one Excel file to answer the below questions. ( including the formula using for Excel) In 2011, when the Gallup organization polled investors, 34% rated gold the best long-term investment. In April of 2013 Gallup surveyed a random sample of U.S. adults. Respondents were asked to select the best long-term investment from a list of possibilities. Only 241 of the 1005 respondents chose gold as the best long-term investment. By contrast, only 91 chose bonds. Compute the...
Please answer them all in a time crunch and I only have 2 questions left in...
Please answer them all in a time crunch and I only have 2 questions left in my subscription. 1. The Brady Company has a beta of 1.2 and just paid a $5 dividend. Dividends are expected to grow at a constant 4% per year. The risk free rate is 4% and the expected return on the market is 10%. At what price would Brady stock be fairly priced? 2. Omaha Company's capital structure is 48% equity, 37% debt, 15% preferred...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT