Hello, I am new to shell scripting. This is the sample date and time stored in UNIX system. here date part is common I will use shell script and cut this date part. 20221010042234.671 - 20221010042234.491 20221010132747.826 - 20221010132747.712 20221010060016.904 - 20221010060016.903 Input 132747.826 - 132747.712 060016.904 - 060016.903 042234.671 - 042234.491 Expected output 0.18 0.11 0.001 What I have tried: <pre>Our UNIX system doesn't support mktime,use,my date -d, most of the functions are missing. I'm looking for assistance in writing a shell script to calculate the time difference. awk -F, -v OFS=',' '{ print $1-$2 }' Simple subtraction is not working for the 00th and 59th minutes.
perl -e "print $arg1 - $arg2"
echo "scale=3; echo $arg1 - $arg2" | bc
echo $arg1 $arg2 | awk '{ printf "%.3f", $1 - $2}'
bc
\"\n\"
"%.3f\n"
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)