How to extract a field from ls-l command and display?

So I want to put a line at the end of my script which greps for keywords from syslog.log that outputs the following after it is done:

"This file was last modified on (thisdate)"

I know I can use the following to get the date:

rtidsvb(izivanov):/home/izivanov> ll /var/adm/syslog/syslog.log 
-rw-r--r--   1 root       root        503064 Apr 12 12:06 /var/adm/syslog/syslog.log

I know I can use cut -f5 -f6 to get just the date but don't know how. How can I use that and input it into the line in the script for (thisdate)? Or is there an easier way to input date of the file.

I'm relatively new to scripting and UNIX...

Thanks a bunch...

try using

ll | awk '{print $6$7$8}'
1 Like

Thank you so much...and how do I put spaces in the code between $6$7$8 so that I would separate fields for better visual purposes?

---------- Post updated at 03:13 PM ---------- Previous update was at 03:11 PM ----------

Never mind, I got it. You put them under quotes.

GNU date has -r option to display modification date of a file:

date -r /var/adm/syslog/syslog.log "+%D at %T"

Solved