Seelct case based on current time

HI Guys im tring to write a bash sccript which will give me the time of the next us from my local stop

i have a list of times as below

but have no dea how to do thia using a select case of if then statment can any one give me a heads up ?

any help would be appreciated

Pete

Using case statements

Give it a try and let us know what you've come up with :slight_smile:

Trying heavily to infer your request from the fragments of orthography that you posted, and presuming a grep with the -A option, I came up with

date +"%H%MX" | sort - file | grep -A1 X | tail -1
1922
1 Like

thanks worked for me much appreciated :slight_smile:

You could also try using awk, here we presume your input file is sorted as per the example:

awk -v NOW=$(date +"%H%M") '$1 > NOW { print ; exit }' infile