This is a UNIX shell scripting question. Consider the files files l2b1.iva, l2b2
ID: 3810727 • 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
#!/bin/sh
$stringalies1="D"
$stringalies2="B"
$stringalies3="P"
$stringalies4="Q"
$stringalies5="R"
$stringalies6="H"
$stringalies7="O"
$stringalies8="C"
$stringalies9="K"
$stringalies10="W"
$stringalies11="L"
filea='l2b1.iva'
fileb='l2b2.iva'
filec='l2b3.iva'
paste filea fileb filec > filed.txt
file="filed.txt"
while read lineA
do
echo $lineA
s1=$(echo "$test1" |cut -d" " -f 1)
s2=$(echo "$test1" |cut -d" " -f 2)
s2=$(echo "$test1" |cut -d" " -f 4)
s2=$(echo "$test1" |cut -d" " -f 6)
result_string="${s1/Date/$stringalies1}"
result_string="${s1/Tamb/$stringalies2}"
result_string="${s1/Tref/$stringalies3}"
result_string="${s1/Tm/$stringalies4}"
result_string="${s1/Irradiance/$stringalies5}"
result_string="${s1/Isc/$stringalies6}"
result_string="${s1/Voc/$stringalies7}"
result_string="${s1/Imp/$stringalies8}"
result_string="${s1/Vmp/$stringalies9}"
result_string="${s1/Pm/$stringalies10}"
result_string="${s1/FF/$stringalies11}"
finalString=$s1' '$s2' '$s3' '$s4
$finalString > output.txt
done < $file
Description
Step 1 : Read all three files line by line at a time and concate string and store into one another file say file4.txt
i.e. file 1 line 1 - Date 23/12/2006 , file2 line 1 - Date 24/12/2016, file3 line 1 - Date 25/12.2006
in this case file4.txt contains 6 columns - Date 23/12/2006 Date 24/12/2016 Date 25/12.2006
Step 2 : using cut command we use the column 1 , 2, 4, 6 as per the desired result
in our case cut command result would be - Date 23/12/2006 24/12/2016 25/12.2006
Step 3 : Now we need to replace Date from 'D' character using below command
${s1/Date/$stringalies1}
Now out output would be stored in output.txt
D 23/12/2006 24/12/2016 25/12.2006
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.