12-09-2008
formatting date in ksh
hi all,
in ksh, how do i format date so it includes hour and minute ?? i am trying the following command :
date +%Om/%Od/%Oy%OH:%M
but it displays the hour and minute concatenated with the day/month/year e.g 12/10/0814:08
when i want the output to be
12/10/08 14:08
i tried `date +%Om/%Od/%Oy %OH:%M` but that just leaves the time portion out and displays date only i.e 12/10/08.
thanks in advance.
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
I don't know if this is possible. Still fairly new to ksh scripting. Here is what I am wanting to do with my output.
change the following
From:
1349870987
To:
1,349,870,987
in my output. How do I do this?
Thanks,
S (1 Reply)
Discussion started by: Speide
1 Replies
2. Shell Programming and Scripting
Date format MM/DD/YYYY
required is YYYYMMDD, I tried using sed but could not get it any help please. (4 Replies)
Discussion started by: mgirinath
4 Replies
3. UNIX for Advanced & Expert Users
I cannot seem to get this text file to format. Its as if the awk statement is being treated as a simple cat command.
I manned awk and it was very confusing. I viewed previous posts on this board and I got the same results as with the
the awk command statement shown here. Please help.
... (6 Replies)
Discussion started by: tekline
6 Replies
4. Shell Programming and Scripting
Hi i am writing a cron job.
so for it i need the 60 days old date form current date in variable.
Like today date is 27 jan 2011 then output value will be stote in variable in formet Nov 27.
i am using EST date, and tried lot of solution and see lot of post but it did not helpful for me. so... (3 Replies)
Discussion started by: Himanshu_soni
3 Replies
5. Shell Programming and Scripting
In KSH, I am pasting 2 almost identical files together and each one has a date and time on each line. I need to determine if the first instance of the date/time is greater than the 2nd instance of the date/time. If the first instance is greater, I just need to echo that line.
I thought I would... (4 Replies)
Discussion started by: right_coaster
4 Replies
6. Shell Programming and Scripting
Hi All,
I am attempting to create a fixed length tilde delimited file using printf.
The variables are initialized to fixed length blank spaces
a=' '
b=' '
c=' '
d=' '
Sometimes the variable might contain values and sometimes they are... (5 Replies)
Discussion started by: angie1234
5 Replies
7. UNIX for Dummies Questions & Answers
hi friends,
I m trying to write a script which compares to dates.
for this i am converting dates into no using synatx
as below
v2=`date | awk '{print $2,$3,$4}'`
v3=`date +%s -d "$v2"`
this syntax is working in bash shell ,but fails in ksh shell.
please suggest on this. (12 Replies)
Discussion started by: Jcpratap
12 Replies
8. Shell Programming and Scripting
:oi was trying to write a script to format output of a command in ksh which has output as below:
so i used :
to get
which i require at all times. But problem occurs when status part changes. above output i get when status is SU (success).If the status is IN (inactive), output of... (1 Reply)
Discussion started by: pr5439
1 Replies
9. UNIX for Dummies Questions & Answers
Dear all,
I have an user passing 2 parameter 31/03/2015 and 02/04/2015 to a ksh script. How to print the start date to end date.
Expected output is :
31/03/2015
01/04/2015
02/04/2015
Note :
1. Im using aix and ksh
2. I have tried to convert the given input into a date, didnt... (0 Replies)
Discussion started by: mr.rajaravi
0 Replies
10. Shell Programming and Scripting
Hi.
If I have a txt file in the following format:
option1=123
option2=abc
option3=321
How do I convert it with KSH into the following format (with the additional prefixed string):
${filename},::option1=123,option2=abc,option3=321
Many thanks (3 Replies)
Discussion started by: user052009
3 Replies