This is a UNIX shell scripting question. Consider the files files l2b1.iva, l2b2
ID: 3809512 • Letter: T
Question
This is a UNIX shell scripting question.
Consider the files files l2b1.iva, l2b2.iva, and l2b3.iva from your lab2B. These are raw performance data collected on a solar photovoltaic module installed at ASU Polytechnic campus. These data must be processed to determine the performance output of the system or panel. The 3 files correspond to 3 repeated measurements.
Upon processing, the test data are presented as shown in the table below:
The data in the table above are average values from 3 repeated measurements on panel id gge001. The 3 measurements gge001x, gge001y, and gge001z are shown in the table/file below.
For this lab, we’ll use the file below, obtained from previous labs.
You are to write a script that produces the “Performance Data” table as shown above.
Note the corresponding rows:
PLEASE answer SPECIFICALLY in UNIX Shell Script. Do NOT answer in Java/programming language code or UNIX shell commands.
Danicl Travis b4 ICnmpatibility Mnde Insert vraw Lesign Layout Reterences Mailings Review view Tell me what you want to do File Home Share cut 12 A A Aa A AaB MalmbccL AaBb AaBb. AaBbc Aatboel AaB,C Aria Ee copy Replace Paste B I u a xa x A TA EEE E B mphasis 1 Heading 1 Heading 21 Heading 3 1 Norm Strong Subtitle 1 Tito 1 No Spac. Subtle Em Intense E... select Format Painte Performance Data Date 12/30/2006 Tamb (OC) 15.8 30.1 Tref (OC) Tm (OC) 20.2 Irradiance (W/m 2) 1006.2 8.40 sc (A) 37.14 Voc (V) Imp (A) 7.55 28.19 Vmp (V) 212.86 Pm (W) FF 68.3 203 PM a Type o 4/1/20Explanation / Answer
Create 3 files l2b1.iva, l2b2.iva, and l2b3.iva with content space seperated.
eg.
file 'l2b1.iva' will have data like below :
B 15.8
A 23
P 30.1
file 'l2b2.iva' will have data like below :
B 16.1
A 24
P 29.6
and file 'l2b3.iva' will have data like below :
B 15
A 25
P 29.9
then create a bash script file with contents as below :
##################################################
#!/bin/bash
for i in 1 2 3 # this is total no of lines which input files have. IN my case it's 3, so loop upto 3
do
a=$(cat l2b1.iva | sed -n ''$i' p' | awk '{print $2}')
b=$(cat l2b2.iva | sed -n ''$i' p' | awk '{print $2}')
c=$(cat l2b3.iva | sed -n ''$i' p' | awk '{print $2}')
d=$(cat l2b3.iva | sed -n ''$i' p' | awk '{print $1}')
echo $a $b $c $d | awk '{print $4 " " ($1 + $2 + $3) / 3}'
done
####################################################################
Save script as somename.sh
change permission by "chmod +x somename.sh"
execute the script, see the output and comment if any problem persists.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.