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

a) Assume a directory contains a large number of files of the form ts Rax.xxdxRe

ID: 674159 • Letter: A

Question

a) Assume a directory contains a large number of files of the form ts Rax.xxdxRex.xdx.stdy, where x represents a digit 0 9.

– Write a command line to convert the filenames to ts Rax.xxdxRex.xdx.st (hint: use the rename command).

– Write a bash OR awk OR Perl script to extract information from each ts * filename and write a file in.y modified from a template in.template where y is an integer between 1 and the number of ts * files.

b) The Linux command ls -lt lists information about files in a given directory. Write an awk program which creates a file filesize.dat containing the file name and its size on each line for regular files only (not directories), as well as the total size of these files on the last line.

Explanation / Answer

Solution :

a) Command :

b) Program :