• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 336
  • Last Modified:

Need code formatting in unix


In my unix script I am trying to print the current date and time and in the log file in prints like          200607130821
our dba wants it put in more readable form, COULD YOU PROVIDE ME THE CODE

I WANT TO CAPTURE BOTH STARTDATE WITH TIME AND  END DATE WITH TIME in more readable format, need it ASAP

ATTACHING THE CODE BELOW
----------------------------------------------
CURR_DATE=$(date +%m%d%Y)                  ;export CURR_DATE
echo "Script started at = ${CURR_DATE}"   >> ${LOG_FILE}

did not add the end date in my script yet
---------------------------------------------------
echo "Script completed at = ${CURR_DATE}"   >> ${LOG_FILE}


log file it prints in this format
----------------------------------------------
Script started at = 200607130821
0
shihabf
Asked:
shihabf
1 Solution
 
biraCommented:
it seems that the format you need is

date +%Y%m%d%H%M
0
 
koppchaCommented:
give just date it will be readable.
CURR_DATE=$(date)

It will  be print something like this
Fri Jul 14 11:21:44 CDT 2006
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now