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....
Make a directory named hw4 then cd into that directory • In the hw4 directory use...
Make a directory named hw4 then cd into that directory • In the hw4 directory use nano to create a text file named words.txt that contains 6 words – each on a different line. They can be any random words. For example: eggs apples class homework car games part two: Write a shell script named hw4.sh that first clears the screen (using the clear command) then does the following: • Asks the user (using the echo command) to enter a...
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...
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...
Write and submit the source code for the following program. The program will use an integer...
Write and submit the source code for the following program. The program will use an integer array of size 10 to store the prices of smartphones. It will then determine and print the prices of the most expensive and cheapest phones. Use the following variables: int[] prices = new int[10]; // Array of smartphone prices Assignment Ask the user for the price of each smartphone (using a for loop) Sort the list of smartphones (once) from low to high price...
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
Use the list functions learned in class to perform a series of operations and display the...
Use the list functions learned in class to perform a series of operations and display the output using the following list – [5, 15, 84, 3, 14, 2, 8, 10, 14, 25]. Specifications are as follows: (a) Print a count of the number of times 14 is in the list. (worth 2 pts) (b) Print the maximum number in the list. (worth 2 pts) (c) Print the minimum number in the list. (worth 2 pts) (d) Print the numbers in...
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...
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)
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT