Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Develop a mini-shell, that supports UNIX commond pipeline * The objective is to

ID: 3576036 • Letter: D

Question

Develop a mini-shell, that supports UNIX commond pipeline * The objective is to gain hands on experience in parallel programming * The basic code examples are there already * Your job is to write the control program to create two processes, that communicate with each other through UNIX pipe *Dovelop your programs in two phases phase 1 Get two sample programs working individually, No command line options phase-2 Enchance the program to take commond line options Merge two programs together *Your programs should only read from stdin,write to stdout and stderr. Do NOT "open" any physical file. *Submit a tar file (or zip) per group that includes: * pseudo code, * program source code * compilation commands/script or makefile, * screenshot of user login, program comilation,program execution and the error output * program output in a file * Your program will be checked by the following * gcc your-program.c-o your-program * ./your-programprog_output-file * Diff prog_output-file output-file-you-turned-in * Diff prog_output-file master-output-file

Explanation / Answer

Next, let's use a regular expression that tells grep to find lines with "carol", followed by zero or more other characters abbreviated in a regular expression as ".*"), then followed by "Aug".

Here we are using -i option to have case insensitive search

The sort Command

The sort command arranges lines of text alphabetically or numerically. The example below sorts the lines in the food file

The sort command arranges lines of text alphabetically by default. There are many options that control the sorting

More than two commands may be linked up into a pipe. Taking a previous pipe example using grep, we can further sort the files modified in August by order of size.

The following pipe consists of the commands ls, grep, and sort

This pipe sorts all files in your directory modified in August by order of size, and prints them to the terminal screen. The sort option +4n skips four fields (fields are separated by blanks) then sorts the lines in numeric order.

The pg and more Commands

A long output would normally zip by you on the screen, but if you run text through more or pg as a filter, the display stops after each screenful of text.

Let's assume that you have a long directory listing. To make it easier to read the sorted listing, pipe the output through more as follows

Option Description -n Sort numerically (example: 10 will sort after 2), ignore blanks and tabs. -r Reverse the order of sort. -f Sort upper- and lowercase together. +x Ignore first x fields when sorting.