How Do I backdate some to prior month?


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers How Do I backdate some to prior month?
# 1  
Old 06-03-2008
How Do I backdate some to prior month?

I am currently programming a shell script and am running into an issue with how to backdate the timestamp to the prior month.

Anyone have any suggestions as to how to backdate??

current date timestamp is: date +%Y%m%d-%H%M

which being the month is 06 i want it to output 05.

Any suggestions please post

Thank you.
# 2  
Old 06-03-2008
date -d 'month ago' should work on Linux, and possibly other platforms with the -d option; or you can do some heavy gymnastics with $TZ
 
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Need last month files after 10th of every month

Hi, I need all file names in a folder which has date >= 10th of last month, Example : files in folder AUTO_F1_20140610.TXT BUTO_F1_20140616.TXT CUTO_F1_20140603.TXT FA_AUTO_06012014.TXT LA_AUTO_06112014.TXT MA_AUTO_06212014.TXT ZA_AUTO_06232014.TXT Output: AUTO_F1_20140610.TXT... (9 Replies)
Discussion started by: nani1984
9 Replies

2. Shell Programming and Scripting

How to add decimal month to some month in sql, php, perl, bash, sh?

Hello, i`m looking for some way to add to some date an partial number of months, for example to 2015y 02m 27d + 2,54m i need to write this script in php or bash or sh or mysql or perl in normal time o unix time i`m asking or there are any simple way to add partial number of month to some... (14 Replies)
Discussion started by: bacarrdy
14 Replies

3. Shell Programming and Scripting

Convert From Month Number to Month Name

Hi, I have a script that accepts an input date from the user in yyyy-mm-dd format. I need to get the mm-dd part and convert it to month name. example: 2011-11-15 I want that to become "Nov 15" I don't have the GNU date, I am using an AIX os. Thanks. (1 Reply)
Discussion started by: erin00
1 Replies

4. OS X (Apple)

Upgrade prior download without wi-fi

New Apple user going crazy with the wi-fi connection issues.... Went to the Apple store and downloaded 10.7.3 but delayed the install. Came home and wireless was working much better, but I screwed it up with the "Renew DHCP Lease" sleeping wi-fi attempted fix. I now see that 10.7.3 didn't... (0 Replies)
Discussion started by: b79holmes
0 Replies

5. Shell Programming and Scripting

Script to counting a specific word in a logfile on each day of this month, last month etc

Hello All, I am trying to come up with a shell script to count a specific word in a logfile on each day of this month, last month and the month before. I need to produce this report and email it to customer. Any ideas would be appreciated! (5 Replies)
Discussion started by: pnara2
5 Replies

6. Solaris

IPF on Solaris 10 prior 10 8/07 releases

I'm trying to enable IPF ( ip filter ) on solaris 10 release 6/06 Solaris 10 6/06 s10s_u2wos_09a SPARC so i enabled svc:/network/ipfilter:default it was disabled by default and svc:/network/pfil:default was enabled and online there only one config file under etc $/etc/ipf/ipf.conf i... (1 Reply)
Discussion started by: h@foorsa.biz
1 Replies

7. UNIX for Dummies Questions & Answers

print previous month (current month minus 1) with Solaris date and ksh

Hi folks month=`date +%m`gives current month Howto print previous month (current month minus 1) with Solaris date and ksh (7 Replies)
Discussion started by: slashdotweenie
7 Replies

8. UNIX for Dummies Questions & Answers

moving files prior to 2 days

Hi All, I have a question. i have a directory say /home/pavi/logs ls -ltr gives all the files in the /home/pavi/logs directory. i am trying to move only those files existing in this folder prior to 2 days. i.e files exiting say May 9th and May 8th remain in this directory but all the... (12 Replies)
Discussion started by: pavan_test
12 Replies

9. Shell Programming and Scripting

awk and split and variable used prior

I am trying to use awk and its split function to get the number of tokens in a string that are seperated by underscores. ex_alex_is_testing_this_script_ex would return 7. It works when I directly put the string in. However, I can not get it to work when I try to refer to a variable used earlier... (2 Replies)
Discussion started by: rx82000
2 Replies
Login or Register to Ask a Question