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:
Peruser grouping of filerelated 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 filerelated 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 : 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 andor 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 dir dir dir
ls laR time style Y m d H : M : S dir
or if you have defined the aforementioned alias, equivalently:
lsa dir dir dir file dir
lsa r dir file dir
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:
assignbash a bash script used as the driver program for your awk script
assignawk the awk program used in assignbash
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
