Question: For this assignment you will use awk to create a program for summarizing and printing information based on the directory listing data of files and

For this assignment you will use awk to create a program for summarizing and printing information
based on the directory listing data of files and information.
You are not to use any other programs, utilities, or scripting languages not covered in class, unless
otherwise specifically and explicitly stated in this document.
Your program should take the output from the modified ls command line seen below, and process the
data in order to output the aggregate information:
ls - la -- time - style ='+% Y -% m -% d % H :% M :% S '
In fact, to avoid human error and ensure you are always using the correct command line, I suggest
creating and adding a new alias to your bash resource configuration file:
alias lsa ="\ ls - la -- time - style ='+% Y -% m -% d % H :% M :% S '"
The aggregated information processed from the directory listing data should consist of the following (see example later for proper output formatting):
Per-user grouping of file-related counts found in specified directories
Username of the entity owning these files
Total number of files found owned by this user, printing two values: all files versus hidden
files
Total number of directories found that are owned by this user
Total number of other files found that are owned by this user
Total file storage (in bytes) occupied by the users regular files.
Itemization of the oldest and newest regular files found (if no regular files exist in the listing,
simply report "None" for these items. If only one regular file exists, it is reasonable to report this
file as both the oldest and newest.)
otal file-related counts found in the specified directories
Total users owning files within these paths
Total number of files found, printing two values: all files versus hidden files
Total number of directories found
Total number of other files found
(these items include, but are not limited to, symbolic links, FIFOs, character or block devices,
etc. Basically, anything that is not a regular file nor a directory will fall under this category)
Total file storage (in bytes) occupied by all regular files listed.
Note: again, do not use sed , Python, or any other languages or utilities not explicitly allowed by this
assignment.
Note 2: ensure to test the processing of ls listings for multiple directories, rather than just one. Such
listings can be generated by passing more than one directory to ls and/or by the simple addition of the
-R recursive option to the custom ls command shown previously. Two examples of such command lines
can be seen here:
ls - la -- time - style ='+% Y -% m -% d % H :% M :% S ' dir1 dir2 dir3
ls - laR -- time - style ='+% Y -% m -% d % H :% M :% S ' dir1
or if you have defined the aforementioned alias, equivalently:
lsa dir1 dir2 dir3 file1 dir4
lsa -r dir1 file1 dir2
Script Execution
Your program should each be invoked through a single bash file (see below) with input taken from stdin.
The resulting output should be printed directly to stdout
Your submission should consist of exactly two files:
assign3.bash - a bash script used as the driver program for your awk script
assign3.awk - the awk program used in assign3.bash

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!