Get Instant Help From 5000+ Experts For
question

Writing: Get your essay and assignment written from scratch by PhD expert

Rewriting: Paraphrase or rewrite your friend's essay with similar meaning at reduced cost

Editing:Proofread your work by experts and improve grade at Lowest cost

And Improve Your Grades
myassignmenthelp.com
loader
Phone no. Missing!

Enter phone no. to receive critical updates and urgent messages !

Attach file

Error goes here

Files Missing!

Please upload all relevant files for quick & complete assistance.

Guaranteed Higher Grade!
Free Quote
wave
Implementing Functions by Chaining Unix Utility Programs

Task

In this assignment, you are asked to implement functions by chaining the standard Unix utility programs. In particular, you are asked to produce a program that searches an input file, selects the lines that match a given regular expression, and sorts the matched lines in reverse order.

Your program should take three arguments:


You are not expected to implement the specific functions, such as matching a regular expression or sorting the lines in reverse order. Rather, you should be using existing Unix utility programs:

1. grep is a utility program which is a file pattern searcher. It takes one command-line argument (the PATTERN string in our case) and search for matches line by line from the standard input (or the file specified as the second command-line argument). When a match is found (a line that matches with the PATTERN string), the program prints the line to the standard output. The utility program outputs all matched lines.

2. sort is a utility program that sorts the text file by lines. By default, it reads from the standard input and generates the sorted text to the standard output. Use -r option to sort in reverse order. 

3. Your program should use fork and exec system calls to run the utility programs. You should also use pipe and dup/dup2 system calls to connect them, so that, for example, the standard output of the grep program is "piped" to the standard input of the sort program.

support
Whatsapp
callback
sales
sales chat
Whatsapp
callback
sales chat
close