Question

Use HEAD to output the first 10 lines of ‘foo.txt’ Use CAT and pipe the output...

Use HEAD to output the first 10 lines of ‘foo.txt’

Use CAT and pipe the output to HEAD to print out the first 10 lines of ‘foo.txt’

Use TAIL to print out the last 10 lines of ‘foo.txt’

Use HEAD to print out the first 3 lines of ‘foo.txt’

Use CAT and SORT to output ‘foo.txt’ in sorted order.

Use SORT (only) to output ‘foo.txt’ in sorted order.

Use SORT and pipe to UNIQ to output only the unique entries in sorted order in ‘foo.txt’.

Homework Answers

Answer #1

1. head -n 10 foo.txt
first 10 lines of 'foo.txt' are displayed
2. cat foo.txt | head -n 10
initially foo.txt is read and then this is piped to the head command which retrieves the first 10 lines and displays them
3. tail -n 10 foo.txt
last 10 lines are displayed
4. head -n 3 foo.txt
first 3 lines are displayed
5. cat foo.txt | sort
initially foo.txt is read and then the lines are displayed in sorted order
6. sort foo.txt
displays file contents in sorted order
7. sort foo.txt | UNIQ
sorts the the file and then displays the unique lines in it.

Know the answer?
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
Similar Questions
write a script named print_lines.sh that uses head and tail together to print out a specific...
write a script named print_lines.sh that uses head and tail together to print out a specific set of lines from a file. The script should take three arguments: the line number to start at, the line number to stop at, and the file to use. Here's an example run: [user@localhost ~]$ print_lines.sh 7 10 /etc/passwd shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown halt:x:7:0:halt:/sbin:/sbin/halt mail:x:8:12:mail:/var/spool/mail:/sbin/nologin operator:x:11:0:operator:/root:/sbin/nologin [user@localhost ~]$ In this example, the script prints line 7 through 10 (inclusive) of the /etc/passwd file. Your script must do...
*****C++ program***** Please implement the following, comments throughout code to explain, and provide screenshots of output...
*****C++ program***** Please implement the following, comments throughout code to explain, and provide screenshots of output for proof. Write a program for sorting a list of integers in ascending order using the bubble sort algorithm. Implement the following functions: Implement a function called readData int readData( int *arr) arr is a pointer for storing the integers. The function returns the number of integers. The function readData reads the list of integers from a file call data.txt into the array arr....
This program is in C++, And please consider " sort pass #" for the output: Write...
This program is in C++, And please consider " sort pass #" for the output: Write a program that uses two identical arrays of eight integers. It should display the contents of the first array, then call a function to sort it using an ascending order bubble sort, modified to print out the array contents after each pass of the sort. Next the program should display the contents of the second array, then call a function to sort it using...
C++ Goals  Build single linked lists using pointers  Learn how to manipulate linked lists...
C++ Goals  Build single linked lists using pointers  Learn how to manipulate linked lists In this lab, you will create simple single linked structures consisting of Node objects. Each node will have a pointer to the next node. You will use a head pointer to keep track of the first node in the linked list, and a tail pointer to keep track of the last node in the linked list. Set both head and tail to NULL when...
Create program that sorts words of a string based on first letter of each word. Use...
Create program that sorts words of a string based on first letter of each word. Use C programming language. - Only use stdio.h and string.h - Remove any newline \n from input string - Use insert function - Input prompt should say "Enter string of your choice: " - Output should print sorted string on new line Example:     Enter string of your choice: this is a string     a is string this
A Queue is a linked list with pointers to both the head of the list as...
A Queue is a linked list with pointers to both the head of the list as well as the tail (or the last element) of the list. Given a queue Q, Q.head gives the head of the queue and Q.tail gives the tail of the queue. Give O(1) time algorithms for the following tasks. Enqueue • Input: A queue Q of distinct integers and a queue element a not in Q. 1 • Output: Q with the element a added...
IN JAVA Iterative Linear Search, Recursive Binary Search, and Recursive Selection Sort: <-- (I need the...
IN JAVA Iterative Linear Search, Recursive Binary Search, and Recursive Selection Sort: <-- (I need the code to be written with these) I need Class river, Class CTRiver and Class Driver with comments so I can learn and better understand the code I also need a UML Diagram HELP Please! Class River describes river’s name and its length in miles. It provides accessor methods (getters) for both variables, toString() method that returns String representation of the river, and method isLong()...
Try doing a task 3 different ways: a. Use an interactive Python session (shell) to print...
Try doing a task 3 different ways: a. Use an interactive Python session (shell) to print out a line of 5 stars 10 times (so there will be 10 lines of output, each line containing 5 stars) b. Write a function that does the same thing as above, having each line printed individually (you can do this either in the shell or in a module; either way, just copy and paste your code when submitting)
[Lab Task HTML/JAVASCRIPT] Please read 10 numbers that are list below, sort the numbers and then...
[Lab Task HTML/JAVASCRIPT] Please read 10 numbers that are list below, sort the numbers and then print those numbers. 10 numbers = { 9, 3, 2, 1, 10, 30, 4, 6, 7, 8} Output should have a sorted list [Reference JavaScript code] <html> <body>     <H1>prompt()</h1>     <p id="pro"></p>     <script>        // Array creation        var num= new Array();               var ix = 0;        // Read 10 numbers        for (ix = 0; ix < 10; ix++)...
This is in java and you are not allowed to use Java API classes for queues,...
This is in java and you are not allowed to use Java API classes for queues, stacks, arrays, arraylists and linkedlists. You have to write your own implementations for them. You should construct a BST by inserting node values starting with a null tree. You can re-use the code for the insert method given in the sample code from the textbook. -insert method is provided below Your code should have a menu driven user interface at the command line with...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT