2022,01,24,00,-о.70,-2.73,4,0 2022,01,24,06,-2.38,-7.18,17,4 2022,01,24,07,-2.38,-6.68,14,6 2022,01,24,08,-2.38,-5.18,12,2 2022,01,24,09,-1.38,-3.68,13,0 2022,01,24,23,4.62,-0.15,7,0
Write a function extractData in your shell script wparser.bash. This function will perform the core processing logic associated with each file. The main script will just iteratively call this function with different files as its argument.
USE grep, awk, sed, find
This function should accept a data file as its argument. This function should then produce an output of the following format that that contains only the temperature and wind information from the sensors along with a header. (see image; truncated for brevity). A clean format of data like this form can be used by various
The script is basically only including the year, month, day and hour information, followed by the temperature reported by each temperature sensor, and wind speed from wind sensors at that time. If a temperature sensor’s reading is NOINF or MISSED SYNC STEP in the original data file for that particular time, the script must instead output the previous readout for that temperature sensor.
For simplicity, you can assume that the first readout for all the temperature sensors in a given day does not have any issues. The output should follow the same order of time as in the original data file.
The script also translates the wind speed direction codes (which runs from 0 through 7) to appropriate mnemonics, i.e. (N,NE,E,SE,S,SW,W,NW) respectively.
Immediately following the previous output produced from a data file, the script (aka inside the function to be specific) should produce the statistics as to what was the maximum as well as the minimum temperature and wind speed that was reported for a given hour. The format is given below. For this report, it is important to ignore the temperature sensors that it was not able to read data for that hour and consider only the sensors that were functioning and produced a valid reading in that hour.
Step by step
Solved in 2 steps with 1 images