[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Need code formatting in unix

Posted on 2006-07-14
2
Medium Priority
?
329 Views
Last Modified: 2010-04-21

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
Comment
Question by:shihabf
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 6

Accepted Solution

by:
bira earned 2000 total points
ID: 17109235
it seems that the format you need is

date +%Y%m%d%H%M
0
 
LVL 8

Expert Comment

by:koppcha
ID: 17109676
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

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Attention: This article will no longer be maintained. If you have any questions, please feel free to mail me. jgh@FreeBSD.org Please see http://www.freebsd.org/doc/en_US.ISO8859-1/articles/freebsd-update-server/ for the updated article. It is avail…
FreeBSD on EC2 FreeBSD (https://www.freebsd.org) is a robust Unix-like operating system that has been around for many years. FreeBSD is available on Amazon EC2 through Amazon Machine Images (AMIs) provided by FreeBSD developer and security office…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Suggested Courses

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question