Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using UNIX answer the following question please! Question has 18 short steps. Please show output. Q5. Commands to study to answer this question: tail, head,

Using UNIX answer the following question please! Question has 18 short steps. Please show output.

Q5. Commands to study to answer this question: tail, head, cmp, diff, comm, uniq, touch,

umask, grep, vi, cat, ls, and echo

Two files can be compared using cmp command and diff command depending on requirements.

In order to do this question, create two files with 12 or more names with one name in each line. Make sure that some names in the two files are same and some are different. Ensure that there are few consecutive lines with identical names (duplicate lines) in each file. Also, make sure that some of the names are the same in both files.

Create these two files before issuing the script command to answer this question.

  1. Display the content of each file, one at a time
  2. Compare the two files using cmp command
  3. Find the differences between using diff command
  4. Sort first file and store the result by redirecting the output to a file as sorted
  5. Sort second file and store the result by redirecting the output to another file as sorted

Two files can also be compared comm command. There are differences between cmp, diff and commcommands. Read about them and understand the differences.

  1. Compare the two sorted files using comm command
  2. Display ONLY the bottom 5 lines of the first file
  3. Display the top few lines of the second file using the default line count, that is, without using any option in the command. Count and find how many lines it displays by default
  4. Issue appropriate command to display the content of first file removing consecutive duplicate lines
  5. Create the file hw2before_setting_umask using touch command
  6. The umask command can be used to set or change the default file permissions to be set when a new file is created. Issue umask 600 command
  7. Create the file hw2after_setting_umask using touch command
  8. Display the file permissions set on hw2before_setting_umask and hw2after_setting_umask
  9. Using echo command answer what permissions were removed for the owner due to the above umask command

The grep command can be used to search for a string in one or more files. When the line with the string is found, it is displayed. Check this by issuing the following grep commands.

  1. Issue a grep command on hw2test1 with a name that exists in hw2test1.
  2. Issue a grep command on hw2test[12] with a name that exists in both files (hw2test1 and hw2test2).
  3. Issue a grep command on hw2test[12] with a name that does not exist in both files.
  4. What difference you see between (16) and (17) by Observing the output of above three grep commands

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle Database 19c DBA By Examples Installation And Administration

Authors: Ravinder Gupta

1st Edition

B09FC7TQJ6, 979-8469226970

More Books

Students also viewed these Databases questions

Question

What does Processing of an OLAP Cube accomplish?

Answered: 1 week ago