Solved-Assignment XML Dir- Solution

$30.00 $19.00

​Introduction The purpose of this assignment is for students to become comfortable with basic commands, documentation, file redirection – i.e. the bash shell), a Unix editor, the Unix file system using Unix filters (including Awk) to solve text processing problems. Your task is to recurse through a subtree of the filesystem and put a file…

You’ll get a: . zip file solution

 

 

Description

5/5 – (2 votes)

Introduction

The purpose of this assignment is for students to become comfortable with basic commands, documentation, file redirection – i.e. the bash shell), a Unix editor, the Unix file system using Unix filters (including Awk) to solve text processing problems.

Your task is to recurse through a subtree of the filesystem and put a file called dir.xml in each directory. You will pull data from 2 sources: the directory itself, and a file that may appear in each directory called README .

Sample Directory

See tux:/home/kschmidt/public_html/CS265/Assignments/Bash-Dir2XML/CS265 . Here is what the directory looks like:

CS265:
   index.html
   Files/
   Labs/
      README
      labs.html
      1/
         README
         file1.1
         file1.2
         file1.3
         index.html
         other4
         other5
      2/
         Data/
            README
            a
            b
            c
         README
         file2.1
         file2.2
         index.html
         other1
         other4
         other5
      3/
         README
         file3.1
         file3.2
         file3.3
         file3.4
         index.html
         other4
   Lectures/
      README
      lecs.html

README

The README file may have 2 entries, each on its own line. Fields are separated by colons. Neither entry is required:

  • index – lists (maybe) a single file, the top-level HTML page for this directory.

  • required – a list of files that should be in this directory


To Do

You will write a script (or, scripts) that will take an optional argument, the directory to process. If not argument is supplied, use the current directory.

In each subdirectory (including the top-level directory on which the script was called) you will place a file called dir.xml . If it already exists, simply overwrite it. Do not include it as one of the files listed.

The root element will be direntry. It may contain up to 3 child nodes: index, required, and other. These three elements will contain text elements, either of type file or dir.

Index and required data will be harvested from README (use AWK to parse this file). Other files will be found by taking a listing of the directory, looking for files or directories that weren’t listed in README.

For example, the following file would be placed in CS265/Labs/2 :

dir.xml


Submission

Do not submit temporary files, nor your test data. Just the required scripts, and any helper files.

What to hand in

  • a1-top — your top-level script, the entry point, the script we will call with the directory to be processed

  • All the rest of your source code

  • README (optional) — anything you want to tell us before we grade.