check timestamp on specific files

I have a health check script homed in /u/ainet/scripts
I need to check the time stamp on a file in /opt/config/log/
The file is called Backupdisk.out
I want write the same info that you get when you do a ls -l into a file

This is what I have been trying:

cd /opt/config/log/
ls -l | awk '$9 = "Backupdisk.out" {print $9," last successful "$6, $7," "$8" file size =", $5}' > /cust_use/home/ainet/scripts/allan.out

the desired out put in allan.out would be

Backupdisk.out last successful May 16 14:05 file size = 3365

And apart from the fact that you need to double the equals sign in the condition, does it work?

1 Like

I was getting the errors
awk: syntax error near line 1
awk: bailing out near line 1

but thanks to your double equals sign, it now works perfect.

Thanks,
Al