date command op formation


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting date command op formation
# 1  
Old 01-01-2008
date command op formation

Dear All

I am facing below mention problem plz suggest me solution.

Op of date command:

> date
Tue Jan 1 12:17:52 IST 2008

Now i want Jan 1 12: or Jan 1 12 op in some another variable.

I had tried awk but if give me problem when there is date comes in 2 digit i.e. greater that 9. at that time op of date commnad contain only 1 space between Day month and date.
i.e. If date < 10 then op:Tue Jan 1 12:17:52 IST 2008
if date > 9 then op: Mon Dec 31 12:17:52 IST 2008
So i want direct op from date commnad means it should contain 2 space bet month and date when date is < 10 and contain 2 space when date is > 9.

Kindly suggest me,

Regards
jaydeep
# 2  
Old 01-01-2008
Your requirements are unclear. Assuming you want fixed formatting
the following should work:

Code:
 date "+%b %e %l"

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. HP-UX

awk command in hp UNIX subtract 30 days automatically from current date without date illegal option

current date command runs well awk -v t="$(date +%Y-%m-%d)" -F "'" '$1 < t' myname.dat subtract 30 days fails awk -v t="$(date --date="-30days" +%Y-%m-%d)" -F "'" '$1 < t' myname.dat awk command in hp unix subtract 30 days automatically from current date without date illegal option error... (20 Replies)
Discussion started by: kmarcus
20 Replies

2. HP-UX

HP/UX command to pull file name/date based on date

HI, Can anyone tell me how to pull the date and file name separated by a space using the find command or any other command. I want to look through several directories and based on a date timeframe (find -mtime -7), output the file name (without the path) and the date(in format mmddyyyy) to a... (2 Replies)
Discussion started by: lnemitz
2 Replies

3. Programming

Not a repeated question (Perl Script Create Football Formation)

https://www.unix.com/programming/252468-perl-script-create-football-formation.html https://www.unix.com/members/43551.html, it is not repeated question. please read it before u block my question. Unblock it for me. Thanks:mad: (0 Replies)
Discussion started by: Tzeronone
0 Replies

4. Shell Programming and Scripting

Football formation

I'm trying to create a perl script that will automatically fit the player's name to the formation. For example, in my: DR.txt Arbeloa 200 Carvajal 190 Ramos 180 DC.txt Ramos 200 Pepe 190 Varane 180 DL.txt Marcelo 200 Coentrao 190 Arbeloa 180 formation.txt: DR DC DC DL DR (7 Replies)
Discussion started by: Tzeronone
7 Replies

5. Programming

Perl script to create football formation

I need help to create varieties of football formation. The available positions are: GK SW DR DC DL WBR DM WBL MR MC ML AMR AMC AML ST But the conditions are: a. the maximum number in 1 formation: GK is 1 SW is 1 (1 Reply)
Discussion started by: Tzeronone
1 Replies

6. Shell Programming and Scripting

Find week of the year for given date using date command inside awk

Hi all, Need an urgent help on the below scenario. script: awk -F"," 'BEGIN { #some variable assignment} { #some calculation and put values in array} END { year=#getting it from array and assume this will be 2014 month=#getting it from array and this will be 05 date=#... (7 Replies)
Discussion started by: vijaidhas
7 Replies

7. UNIX for Advanced & Expert Users

Data formation

I have a data like as follows, I need to format it as shown in as below. Request you to help me here ? I/P aa|3|1 aa|4|2 bb|3|1 bb|4|1 cc|3|26 cc|4|1 O/P aa|3|1|4|2 bb|3|1|4|1 cc|3|26|4|1 Thanks, Srikanth (5 Replies)
Discussion started by: srikanth38
5 Replies

8. Shell Programming and Scripting

Perl string formation from array

HI I ma using perl programming my perl is like this $InputFile = $ENV{UDE_TMP} . "/" ."cre_fmr_gen.temp_data_file_gen.dat"; @duplicates = `cat $InputFile | cut -d "|" -f 1,1 | sort | uniq -c | awk '{ if(\$1>1) {print \$2;}}'`; my $cusiplist ; foreach $cusip (@duplicates) {... (1 Reply)
Discussion started by: ptappeta
1 Replies

9. Shell Programming and Scripting

Formation of sql files

Dear Experts, I have a scenario where I have to form sql queries in a file using echo command. I have file1 which has more than 10 lac numbers. For each Number in file 1, I need to create 5 sql queries resulting in 50 lac queries totally. For doing this I use the below simple method, for i... (5 Replies)
Discussion started by: Naga06
5 Replies

10. Shell Programming and Scripting

how to obtain date and day of the week from `date` command

Hi, does anybody know how to format `date` command correctly to return the day of the week? Thanks -A I work in ksh.... (1 Reply)
Discussion started by: aoussenko
1 Replies
Login or Register to Ask a Question