Question

what is the output of the following commands: pr -t -n -d -o 10 group12 sort...

what is the output of the following commands:

pr -t -n -d -o 10 group12

sort -t: -k3,3 -n /etc/group

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Note : First of all the above commands uses some files which may be different in your system and my system . So, I will tell the purspose of above command and provide screeshot of the output of command that I executed in my linux terminal.

So here goes your answer:

1) pr -t -n -d -o10 group12 :  pr command is use to prepare or convert a text file for printing in the console.

  • -t : This option will omit the page header and trailers. This will remove the left over space in header or trailer of the page , so you can see the output properly.
  • -n : This option will display a line number for each line of text, i.e first line will have line number 1 , and so on.
  • -d : This option will insert double space in output . You can see the spacing between two lines in output screenshot below.
  • -010 : This option will create a margin space with a numerical offset. Here 10 is the offset which means 10 units of extra margin from default margin.
  • group12 : It is the file name.

Output 1)  This is the what the group12 file contains. See below.

Below is the output of pr -t -n -d -o10 group12 command : See how the output is formatted with margin , line numbers and double space between two lines.

2) sort -t: -k3,3 -n /etc/group :   This command is use to sort a text file . This command can be modified by using many options available, to reverse sort, numeric sort, sort on basis of a particular column etc.

  • -t = This option is used to use a field separator like : . Here in command the field separator is : . You can see in the output screenshot.
  • -k = This option is used to sort on a certain column and specify the column number on the basis of which you want to sort the file. Here it is 3rd column and end at 3rd column.
  • -n = This option is used to sort the numeric values /data . Here column 3 is numeric in nature (see screenshot).
  • /etc/group = The etc is the directory under which a file named group is present.

Output 2 : This is what the group file contains , (I am sharing a short snap of the file, because the file is long.) Initially you can see the group file is unsorted ( column 3 is unsorted marked red).

Now see below the screenshot,  the group file is sorted based on column 3 .

Hope you understand the explaination and output of the commands. You can try these commands in your linux/unix terminal.

Thanks for asking, Feel free to post doubts below in comment.

Happy Chegging !!

Add a comment
Know the answer?
Add Answer to:
what is the output of the following commands: pr -t -n -d -o 10 group12 sort...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • The Output of the following Commands: 1. Output of the cp -v /etc/host 2. Output of...

    The Output of the following Commands: 1. Output of the cp -v /etc/host 2. Output of the mv -v /tmp/myfile ~ 3. Output of the rm -v file.txt 4. Output of the rmdir -v data 5. Output of the rm -v file.txt

  • a) Use the bubble sort to sort g, j, o, n, d, f showing the lists...

    a) Use the bubble sort to sort g, j, o, n, d, f showing the lists obtained at each step. b) Show that the function f(n) = (n + 3)(5n – 1) + 13 is O(n?).

  • The following pseudocode describes the algorithm for a sort of n decimal integers of d digits...

    The following pseudocode describes the algorithm for a sort of n decimal integers of d digits each: radixNumberSort(theArray: ItemArray, n: integer, d: integer): void for (j = d down to 1) { Initialize 10 groups to empty Initialize a counter for each groups to 0 for (i = 0 through n – 1) { K = jth digit of theArray[i] Place theArray[i] at the end of group k Increase kth counter by 1 } Replace the items in theArray with...

  • Use the following sequence as the list to sort: [ T, H, A, N, K, F,...

    Use the following sequence as the list to sort: [ T, H, A, N, K, F, U, L ] You need to display the contents of the list during the execution of the algorithm. a) Sort the list using selection sort. b) Sort the list using heap sort. You do not need to draw the heap diagram unless you find it helpful, but you must still show the contents on the list during execution. c) What is the worst-case runtime...

  • PROGRAM DESCRIPTION Implement the combined O(n) radix/bucket sort as described in class. (i.e. divide the input...

    PROGRAM DESCRIPTION Implement the combined O(n) radix/bucket sort as described in class. (i.e. divide the input by radix, bucket sort (with no insertion sort step) once for each radix starting from the least significant. Make sure that your overall implementation is O(n) NPUT The input to your program will an unspecified number of entries. Each entry is a non-negative integer containing nine (zero padded) digits ( this means that the integer may have either leading or trailing zeros), one per...

  • Objective: Practice common UNIX commands. Procedure: The following list of Unix commands are given for self-learning....

    Objective: Practice common UNIX commands. Procedure: The following list of Unix commands are given for self-learning. Use 'whatis' or 'man' command to find out about each command. Your document should include the description or screen shots of the output from each of the command. Commands: df du gzip file history wget Changing access rights: chmod u+x Dir1.0            adds execute permission for the owner chmod go-w file1              removes write permission for the group and others chmod ugo=rw testfile     sets...

  • 6. Probabilities for thet distribution For the T distribution, Stata commands give areas in the right...

    6. Probabilities for thet distribution For the T distribution, Stata commands give areas in the right tail of the T distribution. Exam ples: -ttail (10,0.8) gives p = Pr[T > 0.8] where T ~ t(10) distributed -ínvt tail (10, .05) gives that value of t such that Pr[T > t-05 where T ~ t(10) distributed To see the actual values we can use command display For example, for Pr[T >0.8] where T~t(10) distributed display ttail 10,0.8) gives result 22115021 For...

  • Apply mergesort algorithm to sort S, O, R, T, I, N, G in alphabetical order.

    Apply mergesort algorithm to sort S, O, R, T, I, N, G in alphabetical order.

  • i.) If the commands below will be executed in order, determine the output of the 4...

    i.) If the commands below will be executed in order, determine the output of the 4 echo commands (labeled as A-D): ( 2 Marks ) export z=3 e=10 echo $e - A bash echo $z -B k=4 sh Z=7 echo $k -C exit exit echo $z -D ii.) Given the contents of file (filename: /home/user5/research) below, write the single command line needed to perform the following tasks. SUMMARY GLOSSARY CHAPTER 1 Introduction and Research Approach Reach Obiective REFERENCES APPENDIX A...

  • PYTHON QUESTION Given the following function: def sort(A, n):     for i in range (1, n):...

    PYTHON QUESTION Given the following function: def sort(A, n):     for i in range (1, n):         for j in range(i-1, -1,-1):             if A[j + 1] > A[j]:                 t = A[j+1]                 A[j+1] = A[j                 A[j] = t What would the output be for the following array: A = [3, 10, 2, 8,15]; where n = 5; for each iteration of i (i.e. when i = 1, i=2, i=3, i=4)? A. 10, 3, 2, 8, 15 B....

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT