Professional Documents
Culture Documents
8 Malam 3
8 Malam 3
To complete part of the assignment, you will need to use the uncompressed Files2 folder and the
file dirfile.txt
#1 should be saved to and run from the same directory level as Files and Temp in Files2.
#2 should be saved to the same directory level as dirfile.txt
Save each script with the extension .sh
For each script, change the permissions so they can be executed.
Include your name and script # inside commentary lines in each file.
2. Create a shell script that accepts parameters and uses grep to search for patterns:
a. The script will accept three parameters representing, in order, a file extension, a year
and a new filename.
b. Use grep to search dirfile.txt for all lines that end with the file extension represented by
the first parameter, and write the results to the filename represented by the third
parameter.
c. Use grep to search dirfile.txt for all lines that include the year represented by the second
parameter, and write the results to the filename represented by the third parameter.
Show only the lines that contain the year in the year column.
Test the file with the following when the script is run: bat 2022 and a filename of your
choice.
Submit the two scripts and the output files created in each script to Moodle.