Unix HW 5
|
[Spring 2018] |
IFT 250: Shell & Script Programming with Unix |
|
Lab Activity 5: Formatting with grep, sed, and awk |
For the following labs include the following header in your scripts:
#!/bin/bash
# File name: <filename of your script>
# Author: <Include your full name here>
# Term: <Spring 2018>
# Date: <Include the date you created the script>
Be sure to also include detailed comments in each script!
Part I: Historical artifacts
The oldest commands in UNIX/Linux are found in the /bin directory. They are simply two letters and the preform a single very specific task, but they preform it very well.
Write a shell script called lab5.1 to search the /bin directory and find all commands that are made up of two lower case letters. Your script should save the list of commands, as well as the number of commands found, in a file called lab5.1.out.
Part II: Live Free or Process Data
Write a shell script called lab5.2 which uses the tools you have learned in this unit, including at least one use of regular expressions , grep , sed , paste , and awk , to extract, edit and format the necessary data from the three files to resemble the processed data below:
Performance Data
Curve Name gge0001x gge0001y gge0001z
Date 12/30/2006 12/30/2006 12/30/2006
Time 14:15 14:15 14:16
Tamb (°C) 15.8 16.1 15.0
Tref (°C) 30.1 29.6 29.9
Tm (°C) 20.2 22.3 23.4
Irradiance (W/m^2) 1006.2 1003.5 999.8
Isc (A) 8.40 8.41 8.37
Voc (V) 37.14 36.82 36.62
Imp (A) 7.55 7.53 7.44
Vmp (V) 28.19 27.90 27.86
Pm (W) 212.86 210.15 207.15
FF (%) 68.3 67.9 67.6
Submissions
Once you’ve completed all the activities, perform the following steps for
submission:
1. Make sure all of your answers are correct and complete.
2. Download your scripts lab5.1 and lab5.2 from the ASU file host
https://webapp4.asu.edu/myfiles
Page | 3