I am a beginner in scripting and I am trying to set TPS value for a system according to the time of the server when it executes the script. I am having csv file which contains start time , End time and TPS columns which starts from 00:00 to 23:59 as follows.
StartTime,EndTime,TPS
.....,.....,...
.....,.....,...
11:30,12:00,100
12:00,12:45,200
12:45,13:30,520
.....,.....,...
.....,.....,...
23:40,23:50,920
23:50,23:59,250
Time gaps are not uniform. if the server current time is 11:35, I want to chose the "11:30,12:00,100" line and get it into a seperate file (since 11:35 lies between 11:30-12:00). Also the chosen line will be deleted from the initial csv file.
#Current time into a variable
TS=$(date | cut -d ' ' -f4 | cut -d ':' -f1,2)
echo "Current time = $TS"
Writing the relevant line to a seperate file and removing that line from the initial file is fine for me.
if the TS=11:35, I want to get the output as "11:30,12:00,100" from that csv file. Struggling to code how to get that matching line.
12:00
then you want to print both lines11:30,12:00,100
and12:00,12:45,200
as well as remove both lines (from the csv)