Convert Bash script to AWK script

by Bharat   Last Updated July 11, 2019 18:24 PM

CURTIME=$(date +%s)

LOG=/home/apache_logs.txt ;

FILETIME1=$(stat $LOG -c %Y) ;


I have a script to check log updates and do ( If else ) depending on the output of TIMEDIFF1.

I created this script in Ubuntu and it works fine there but on SunOS, (Generic_150400-64 sun4v sparc sun4v), it is not working; I figured nawk might work, but I'm not sure.

How to assign the value of LOG to FILETIME1 in seconds format? How to subtract the value of CURTIME from FILETIME1? Can someone please help me, by providing the exact commands to do this?

Related Questions

Updated May 16, 2017 18:24 PM

Updated July 11, 2018 10:24 AM

Updated December 12, 2016 08:10 AM

Updated July 29, 2017 23:24 PM

Updated April 24, 2017 15:24 PM