I want to insert the last modified timestamp of a file in the database within a shell script. My script goes like this
#!/usr/bin/ksh
date=date -r /raid/file/test.txt +%d" "%b" "%Y" "% r | awk '{print $1,$2,$3,$4,$5;}'
echo ${date}
sqlplus USR/[email protected] <<ENDOFSQL
INSERT INTO PROD_TABLE VALUES('$date');
exit
ENDOFSQL
I am wondering how to assign the last modified date of the file to a shell variable and use that inside sqlplus.Note that am looking for date in the format 05 May 2011 08:02:27 PM The $date is showing null at the moment and is getting inserted into the table.
Would appreciate any recommendations around the same.