Question

In: Computer Science

Time sensative (linux). Please 1)Show all lines that have only the word hello in file file1....

Time sensative (linux). Please

1)Show all lines that have only the word hello in file file1.

2)Show all lines that have at least five characters.

3)Show all lines that have only 5 digits.

4)Write the command to find out the number of words in the file file1.

5)Write the command to substitute all the words Unix to Linux in a file called file1.

6)Write the command to rename the file file1 to file2.

7)Write the command to list only the directories in the current folder.

8)Use the sed command to print lines 6 to 10. Modify that command to place lines 6 to 10 of file1 into file2.

9)A file has three columns. In column-1 the name of employee and in column-2 he salary of employee is given.

10)Write the line to display the name of employees that make more than 50000.

11)Write a script to read three numbers and find the sum of these numbers. Find the largest number. Display the largest number and the sum.

Solutions

Expert Solution

1) grep -i hello file1.txt

Grep command is used to search for the pattern and -i is the option it iteratively searches the file for the pattern and it displays it encounters the word.

2) grep -r '.\{5\}' file1.txt

To grep command recursively search for the whole file with characters length having 5.

3)egrep '[0-9][0-9][0-9][0-9][0-9]' file1.txt

Or

grep -E '[0-9]{5}' file1.txtlll

This extended grep command will search for the 5 digit numbers in the file.

4) wc -w file1.txt

The wc command searches for the words in the given file and gives us the count.

5) sed -ie 's/Unix/Linux/g' file1.txt

Stream editor is the command to find and replace the pattern. In this s tells that substitute the Unix with Linux and g means globally among the file.

6) mv file1.txt file2.txt

Mv is the only command used to rename the files.

7) ls -d

Ls is the list command , -d means the directory it lists all the directory in the current folder.

8)sed -n 6:10p file1.txt>patch

sed -i patch file2

The first line will copy the lines 6 to 10 to the temporary file patch and the 2 command will insert the patch file to file2.


Related Solutions

Go to your “Documents” directory; a) Create a file “file1” with the text “hello” in it;...
Go to your “Documents” directory; a) Create a file “file1” with the text “hello” in it; Provide command and screenshot. b) Create a hard link named “file2” linked to “file1”; c) Create a soft link named “soft1” linked to “file1”; create another soft link named “soft2” linked to “file2”. d) View information of the 4 files (what command should you use to produce output) – how do you verify which file is a hard link and which file is a...
For Linux: Write a command to append the top 20 lines of the file seq.fasta to...
For Linux: Write a command to append the top 20 lines of the file seq.fasta to a second file named combined.seq.
We have these 3 lines in an excel file. The goal is to set all the...
We have these 3 lines in an excel file. The goal is to set all the lines like the second one ( 26/07/2019) 24-Apr-2019 26/07/2019 03/03/2017 16:29
Instruction: Answer in a Word file and submit. Show the formula and all corresponding numbers you...
Instruction: Answer in a Word file and submit. Show the formula and all corresponding numbers you use in the formula. Do NOT use spreadsheet and submit. 1. (3 points)     You deposit your $10,000 in a new savings account that earn 4 % annually. You don’t take the interest out and keep it in the savings account so that you can earn interest on interest (compounding!). What would be the value of the $10,000 after 40 years? (Show your calculation) 2....
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...
Hello, this is a TAX scenario for a class on pass-through entities. Please show all calculations...
Hello, this is a TAX scenario for a class on pass-through entities. Please show all calculations and work for each question (a-e listed below): KEY INFORMATION: John, Karl, and Laura form an entity under state law to be known as JKL. The entity elects to be taxed as a partnership. The three owners make the following initial contributions: John contributes $26,000 in cash and agrees to do all of the accounting work required by the partnership for 3 full years....
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...
Please answer as many as possible the answers are about 1 line/word long, LINUX What is...
Please answer as many as possible the answers are about 1 line/word long, LINUX What is the name of the account that can do anything on a Unix or Linux system? If you have read permission on a directory, what can you do in it? If you have read permission on a directory, can you read the files in that directory? What permission on a directory allows you to create, delete or rename anything in that directory? If you have...
YOU MUST SHOW ALL WORK (CALCUATIONS) AND DRAW TIME LINES. WRITE WITH THE CORRECT FORMULA TO...
YOU MUST SHOW ALL WORK (CALCUATIONS) AND DRAW TIME LINES. WRITE WITH THE CORRECT FORMULA TO BE USED 1) Jane is 25 years old and was able to save $25,000.    After doing some research, she identifies a stock called HPG Industries that has a dividend yield of 7% that has been consistent for the past 10 years. Based on this information, she decides to invest in this stock. Considering that HPG Industries pays the dividend consistently, how many years will...
PLEASE SHOW WORK FOR ALL, IF YOU'RE ONLY GOING TO DO ONE OF THESE AND NOT...
PLEASE SHOW WORK FOR ALL, IF YOU'RE ONLY GOING TO DO ONE OF THESE AND NOT ALL, DONT ANSWER 12. P. Rose, Inc. is considering a new four-year expansion project that requires an initial fixed asset investment of $1,950,000. The asset will be depreciated straight-line to zero over its six-year tax life, after which time it will be worthless. The project is estimated to generate $2,145,000 in annual sales, with costs of $1,205,000. The fixed asset will have a market...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT