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) ;

TIMEDIFF1=$(expr $CURTIME - $FILETIME1)

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



How should feature-requests be discussed?

Updated July 11, 2018 10:24 AM


Just Starting Bluetooth-Android

Updated July 29, 2017 23:24 PM

Badge proposal: posts that are linked to often

Updated April 24, 2017 15:24 PM