Question

In: Computer Science

please fill in the blanks using c program or lunix with the answers being highlighted 1....

please fill in the blanks using c program or lunix with the answers being highlighted

1.

You will now need four files. These are telnos, telnos2, telnos3, telnos4. These files are all short files that contain names, departments, and telephone numbers. This is what they look like.

telnos

telnos2

Hale Elizabeth Bot   744-6892
Harris Thomas Stat 744-7623
Davis Paulette Phys 744-9579
Cross Joseph   MS    744-0320
Holland Tod    A&S   744-8368

Hale Elizabeth Bot   744-6892
Harris Thomas Stat 744-7623
Davis Paulette Phys 744-9579
Holland Tod    A&S   744-8368

telnos3

telnos 4

Hale Elizabeth Bot   744-6892
Harris Thomas Stat 744-7623
Smith John     Comsc 744-4444
Davis Paulette Phys 744-9579
Cross Joseph   MS    744-0320
Holland Tod    A&S   744-8368

Hale Elizabeth Bot   744-6892
Smith John     Comsc 744-4444
Davis Paulette Phys 744-9579
Cross Joseph   MS    744-0320
Holland Tod    A&S   744-8368

To make it easier to copy you can use the * (wildcard) to copy these files. Type in the command:

                cp /tmp/csc3321/telnos* .  

Remember the . (period) means current directory and will copy all of the telnos files at one time and assign them the names that they have in the instructor's file

In order to see how diff works, type in:

                diff telnos telnos2

What was the result?
________________________________________________________________________________________________________________________________________________________________________________________________________________________

The difference between these two files (telnos and telnos2) is that the 4th line in telnos is missing from telnos2. The first line that diff displays (4d3) indicates that you need to delete the 4th line from file telnos to make the two files match. The 4 is the line number and the (d) is delete. The line number to the left of each of the a,c, or d instructions always pertains to file1. Numbers to the right of the instructions apply to file2. The diff command assumes that you are going to change file1 to file2. The next line that diff displays starts with a less than (<) symbol indicating that this line of text is from file1. Next type in:

                diff telnos telnos3

What was the result?__________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________

In this case, the second line has the (>) greater than sign which means that the extra line is in file2. The a means you must append a line to the file telnos after line 2 to make it match telnos3. Append means to add on to the end. Next is an example of the change feature. Type in the following command:

                diff telnos telnos4

What was the result? __________________________________________________________

What lines do you need to change in order to make the two files alike? ________________________________________________________________________________________________________________________________________________

Notice that the three hyphens indicate the end of the text in the first file that needs to be changed and the start of the second file that needs to be changed. Next, copy telnos to telnos5. What command did you use to do this? ________________________________________________________________________


Next, type in:

                diff telnos5 telnos2

What was the answer that you received? _________________________________________________________________________________________________________________________________________________________________________________________________________________

Use the vi editor to change telnos5 to match the file telnos2. Then check to see if they are now alike.

What command did you use? _________________________________________________________

What was the result? __________________________________________________

What is the output of the diff command when the files match?
_______________________________________________________________________________

When the two files are alike, there is no response. Unfortunately, Unix is not always user-friendly.

Uniq Command

The uniq command displays a file, removing all but one copy of successive repeated lines. If the file has been sorted, uniq ensures that no two lines that it displays are the same. Sort telnos and telnos3 and then send them to a new file called tel2. Type in the following:

                sort telnos telnos3 > tel2

Next look at the file, tel2. What does it contain?___________________________________________________________________________________________________________________________________________________________________________________________________

Next issue the command:

                uniq tel2

What was the result?__________________________________________________________________________________________________________________________________________________________________________________________________________________

The uniq command has three options. These are:

-c   Causes uniq to precede each line with the number of occurrences of the line in the input file

-d   Displays only lines that are repeated

-u   Displays only lines that are not repeated

Issue the command:

                uniq -u tel2

What was the result?__________________________________________________________________________________________________________________________________________________________________________________________________________________

Next, issue the command:

                uniq -d tel2

What was the result?__________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________

Solutions

Expert Solution

Please find the answers below.

Question 1: diff telnos telnos2
What was the result?

4d3
< Cross Joseph   MS    744-0320

Explanation:

The difference between these two files (telnos and telnos2) is that the 4th line in telnos is missing from telnos2. The first line that diff displays (4d3) indicates that you need to delete the 4th line from file telnos to make the two files match. The 4 is the line number and the (d) is delete. The line number to the left of each of the a,c, or d instructions always pertains to file1. Numbers to the right of the instructions apply to file2. The diff command assumes that you are going to change file1 to file2. The next line that diff displays starts with a less than (<) symbol indicating that this line of text is from file1.

Question2: diff telnos telnos3

What was the result ?

2a3
> Smith John     Comsc 744-4444

Explanation:

In this case, the second line has the (>) greater than sign which means that the extra line is in file2. The "a" means you must append a line to the file telnos after line 2 to make it match telnos3. Append means to add on to the end.

Question3: diff telnos telnos4

What was the result?

2c2
< Harris Thomas Stat 744-7623
---
> Smith John     Comsc 744-4444

What lines do you need to change in order to make the two files alike?

Please change 2nd line of `telnos` similar to 2nd line of `telnos4`.

Explanation:

Notice that the three hyphens indicate the end of the text in the first file that needs to be changed and the start of the second file that needs to be changed.

Question4: copy telnos to telnos5. What command did you use to do this?

cp telnos telnos5


Question5: diff telnos5 telnos2

What was the answer that you received?

4d3
< Cross Joseph   MS    744-0320

Question6: Use the vi editor to change telnos5 to match the file telnos2. Then check to see if they are now alike.
What command did you use?

- vim -f telnos5 telnos2
- Press "Esc" and "i" to insert
- Now edit the "telnos5"

What was the result?

As a result, Both telnos5 and telnos2 are similar.

What is the output of the diff command when the files match?

No response

Question:
Sort telnos and telnos3 and then send them to a new file called tel2. Type in the following:
sort telnos telnos3 > tel2
Next look at the file, tel2. What does it contain?

Cross Joseph   MS    744-0320
Cross Joseph   MS    744-0320
Davis Paulette Phys 744-9579
Davis Paulette Phys 744-9579
Hale Elizabeth Bot   744-6892
Hale Elizabeth Bot   744-6892
Harris Thomas Stat 744-7623
Harris Thomas Stat 744-7623
Holland Tod    A&S   744-8368
Holland Tod    A&S   744-8368
Smith John     Comsc 744-4444

Question:
Next issue the command:
uniq tel2
What was the result?

Cross Joseph   MS    744-0320
Davis Paulette Phys 744-9579
Hale Elizabeth Bot   744-6892
Harris Thomas Stat 744-7623
Holland Tod    A&S   744-8368
Smith John     Comsc 744-4444

Question:
Issue the command:
uniq -u tel2
What was the result?

Smith John     Comsc 744-4444

Question:
Next, issue the command:

uniq -d tel2

What was the result?

Cross Joseph   MS    744-0320
Davis Paulette Phys 744-9579
Hale Elizabeth Bot   744-6892
Harris Thomas Stat 744-7623
Holland Tod    A&S   744-8368

Related Solutions

C++ Fill in the blanks please You are required to fill in the blanks in this...
C++ Fill in the blanks please You are required to fill in the blanks in this program. Consider that: -In main, the variables price and quantity were given the names of p (double) and q (int), respectively. -In the getData function, the parameters associated with the main variables p and q were called pp and pq, respectively. // Prototype: Do not include the names // of the variables in the prototype void getData (FILLTHEBLANK , FILLTHEBLANK); int main () {...
Fill in the blanks using the dropdown list. 1. When the perpetual inventory method is being...
Fill in the blanks using the dropdown list. 1. When the perpetual inventory method is being used, the accountant debits __________ __________ and credits Accounts Payable (or Cash) when goods are purchased and debits Cost of Goods Sold and credits __________ __________ when gods are sold, along with the proper sales entry. 2. When prices are rising, LIFO inventory is __________ (higher or lower) than FIFO inventory at the end of the year. This will cause the cost of goods...
using Linux please fill in the blanks : telnos files:
  using Linux please fill in the blanks : telnos files: telnos telnos2 Hale Elizabeth Bot   744-6892Harris Thomas Stat 744-7623Davis Paulette Phys 744-9579Cross Joseph   MS    744-0320Holland Tod    A&S   744-8368 Hale Elizabeth Bot   744-6892Harris Thomas Stat 744-7623Davis Paulette Phys 744-9579Holland Tod    A&S   744-8368 telnos3 telnos 4 Hale Elizabeth Bot   744-6892Harris Thomas Stat 744-7623Smith John     Comsc 744-4444Davis Paulette Phys 744-9579Cross Joseph   MS    744-0320Holland Tod    A&S   744-8368 Hale Elizabeth Bot   744-6892Smith John     Comsc 744-4444Davis Paulette Phys 744-9579Cross Joseph   MS    744-0320Holland Tod    A&S   744-8368...
Q1. SEC, FASB and AICPA Fill in the blanks in the highlighted areas. You can find...
Q1. SEC, FASB and AICPA Fill in the blanks in the highlighted areas. You can find the answers from the following websites: www.sec.gov www.fasb.org and www.aicpa.org Please make sure you scroll down to fill all the blanks! 1. Mission of the SEC 1st blank 2nd blank 3rd blank 4th blank 5th blank …… The mission of the U.S. Securities and Exchange Commission is to ___, maintain______ markets, and facilitate ____. Crucial to the SEC's effectiveness in each of these areas...
14.6 A- Fill in the Blanks for the required C instructions, and also fill in the...
14.6 A- Fill in the Blanks for the required C instructions, and also fill in the missing comments /******************************************************************* This program outputs 30 kHz square wave on port T, bit-0 using timer channel 0 interrupts and the output compare bit operations. *******************************************************************/ #include <mc9s12c32.h> /* derivative information */ #define HALF_P 133 /* Number clocks per 1/2 period */ /******************************************************************/ void interrupt 8 OC0_isr (void); /******************************************************************/ void main(void) {    /******************************************************************/       /* Initialize I/O */             ___________________ = 1;...
Fill in the blanks USING THE TERMS LISTED BELOW, (10 TERMS LISTED) CHOOSE THE BEST ANSWERS...
Fill in the blanks USING THE TERMS LISTED BELOW, (10 TERMS LISTED) CHOOSE THE BEST ANSWERS TO FILL IN THE BLANKS. Paragraph #1: Mark, an investor, examines the financial statements of Disney. He calculates gross profit of services and does a year-to-year variance comparison of service revenues and costs of services. Paragraph #2: Mark then compares the net income taking into account the non-cash activity of Disney (adding it back) as well as the other expenses that he feels do...
Using the below information fill in the answers to parts (a), (b) and (c) for a...
Using the below information fill in the answers to parts (a), (b) and (c) for a change in accounting principle Partial Income Statement using Completed- contract-method for its long-term construction contracts: 2015 2016 2017 Income before taxes 400,000 160,000 190,000 Income tax expense (40%) 160,000 64,000 76,000 Net Income 240,000 96,000 114,000 Partial Income Statement using Cost-to-Cost-method for its long-term construction contracts: 2015 2016 2017 Income before taxes 600,000 180,000 200,000 Income tax expense (40%) 240,000 72,000 80,000 Net Income...
The following program is used to sum arrays. Fill in blanks of the following program to...
The following program is used to sum arrays. Fill in blanks of the following program to complete the program and make the output is: s = 150. #include <iostream.h> class Arr { int *a,n; public: Arr():a(0),n(0){} Arr(int *aa, int nn) {n=nn; a=new int [n]; for(int i=0;i<nn;i++) *(a+i)=*(aa+i); } ~Arr(){delete a;} _____________ {return *(a+i);} }; void main() { int b [5]={10,20,30,40,50}; Arr a1(b,5); int i=0,s=0; _____________ s+=a1.GetValue(i); cout<<"s="<<s<<endl; }
answer all 5 please as this is in steps. 1. Fill in the Blanks A corporation...
answer all 5 please as this is in steps. 1. Fill in the Blanks A corporation has 10,000 bonds outstanding with a 6% annual coupon rate, 8 years to maturity, a $1,000 face value, and a $1,100 market price. MV of debt is The company’s 100,000 shares of preferred stock pay a $3 annual dividend, and sell for $30 per share. Market value of preferred shares is The company’s 500,000 shares of common stock sell for $25 per share and...
PLEASE Fill in the blanks: 1) The group responsible for overseeing the corporation's activities is /are...
PLEASE Fill in the blanks: 1) The group responsible for overseeing the corporation's activities is /are the ________. 2) A corporation is responsible for its own acts and debts because it is considered a ________. 3) The number of shares that a corporation's charter allows it to sell is the ________ stock. 4) ________ bonds can be exchanged for a fixed number of shares of the issuing corporation's common stock. 5) ________ bonds have an option exercisable by the issuer...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT