i have a requirement to compare two time stamps in IF condition and return true whenever the second timestamp is greater than first, i will also be checking, if the timestamp in HHMMSS format( 6 digit time stamp ).Im able to achieve it using awk, however i dont want to give any input file to awk and i will not be able to give input from command line as im running this in a script.
starttime = HHMMSS
endtime = HHMMSS
awk -v val1=$starttime -v val2=$endtime '{ if ( length(val1)==6 && length(val2)==6 && val2 > val1 ) print }' filename
in the above syntax i want to eliminate the file as im not doing any thing against the file and also if awk logic is sucessful my script should continue else it should exit the script.
Can we achieve all this in a single command without using awk command.