grep tomorrow's date


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting grep tomorrow's date
# 15  
Old 01-09-2009
If you have Perl and the Date::Manip module installed:

Code:
date +'%Y%m%d'|perl -ne'use Date::Manip;print UnixDate(DateCalc(ParseDate($_),"tomorrow"),"%d %b %Y\n")'

10 Jan 2009

# 16  
Old 01-09-2009
Hi SFYNC,

I think Date::Manip module has not been installed.

I am getting following error

Can't locate Date/Manip.pm in @INC
# 17  
Old 01-09-2009
This is what I use to get tomorrrows date....
TZ=CST-24 date +"%m %d %Y"
# 18  
Old 01-09-2009
Quote:
Originally Posted by ssachins
Hi SFYNC,

I think Date::Manip module has not been installed.

I am getting following error

Can't locate Date/Manip.pm in @INC
Try entering this command to see what Perl modules you have installed:
Code:
perl -MFile::Find=find -MFile::Spec::Functions -Tlwe'find {wanted=>sub {print canonpath $_ if /\.pm\z/},no_chdir=>1},@INC'

The output can be quite a few lines so I'd redirect it to a file or pipe it through more. You can also pipe it through grep to look for specific names:

Code:
perl -MFile::Find=find -MFile::Spec::Functions -Tlwe'find {wanted=>sub {print canonpath $_ if /\.pm\z/},no_chdir=>1},@INC'|grep Date

# 19  
Old 01-09-2009
Bob Stockler's datemath is a collection of quite useful shell scripts for date manipulations.

Pick it up from my ftp site, ftp.jpr.com.
# 20  
Old 01-09-2009
Quote:
Originally Posted by ssachins
Hi guys,

I need to find tomorrows date in date fomat and should be in variable.
as I need to grep this date in a flat file

ie. if today's date is '09 JAN 2009'

output should be '10 JAN 2009'

unix/perl script will be fine.

To manipulate dates, you should always use a standard format, preferably ISO YYYY-MM-DD, and use a function to convert it to other formats after doing any date arithmetic.

I have a library of shell functions for manipulating dates at The Dating Game.

Code:
. date-funcs
dateshift 2009-01-09 +1

# 21  
Old 01-12-2009
Hello All,

I have found another solution,

/db/pub/infra/GNUshellutils/current/bin/date gives the current date and time as Mon Jan 12 04:05:29 EST 2009

/db/pub/infra/GNUshellutils/current/bin/date -d1day which gives tomorrow's date and time.

To get the desired output, I have used following command

TDATE=`/db/pub/infra/GNUshellutils/current/bin/date -d1day | awk '{print $3,$2,$6}'`

echo $TDATE

which will give the tomorrow's date as 13 JAN 2009.

Thank you all for your support !!!
Login or Register to Ask a Question

Previous Thread | Next Thread

7 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Rebuilding computer tomorrow at work

I'm rebuilding my primary computer at work tomorrow. Currently, it has Windows 7. I would like to replace the main system with either Linux or Unix, although I would like to be able to run a fully operational Windows as a VM within that. Any recommendations on which Linux or Unix to go with? I'm... (6 Replies)
Discussion started by: Sean_
6 Replies

2. Shell Programming and Scripting

How to get tomorrow,yesterday date from date Command

Hi I want to get tomorrow and yesterday date from date command. My shell is KSH and server is AIX. I tried several options, but unable to do. Please help on this. Regards Rajesh (5 Replies)
Discussion started by: rajeshmepco
5 Replies

3. Shell Programming and Scripting

Calculating expiry date using date,sed,grep

Hi, I would greatly appreciate it if someone can help me with my problem. I have a crawler which collects spam URLs everyday & this data needs to be published in a blacklist. Here's the catch: The "Time To Live" (TTL) for each URL is 3 months (or whatever for that matter). If i see the... (5 Replies)
Discussion started by: r4v3n
5 Replies

4. Homework & Coursework Questions

hey guys i need our help to be passed tomorrow.

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: log in time and about the recyclebin 2. Relevant commands, code, scripts, algorithms: im not sure what to... (2 Replies)
Discussion started by: skypigeon
2 Replies

5. UNIX for Dummies Questions & Answers

hey guys i need our help for my assignment to be passed tomorrow.

good day to all. im just a new member. since im a newbie in UNIX, im having trouble learning. problem #1 problem # 2 thank you guys. take good care! (1 Reply)
Discussion started by: skypigeon
1 Replies

6. UNIX for Dummies Questions & Answers

Date change to tomorrow

I have this code in a script that says it is calculating current date: cur_date=`date -u +%m/%d/%Y` If the script is run today during the day, it returns 12/11/2008 If the script is run today during the night, it returns 12/12/2008 Why does it return tomorrow's date if it was run at... (2 Replies)
Discussion started by: mkoay
2 Replies

7. UNIX for Dummies Questions & Answers

Have an interview tomorrow just wondering one thing...

Hi, just a quick question here. I have an interview coming up tomorrow. The job is for a UNIX System Admin. I have a degree in Computer Networking and am familiar with Solaris, but was wondering what should I brush up on before going in to this interview (like any online reference)? Thank you... (2 Replies)
Discussion started by: NELS
2 Replies
Login or Register to Ask a Question