Add previous Sundays date to filename


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Add previous Sundays date to filename
# 1  
Old 08-13-2013
Add previous Sundays date to filename

I am looking for some scripting help. I need to add a time stamp to a file name.

I will append data to a file, and want to add to the file name a time stamp of the previous Sundays date. Any takers?
# 2  
Old 08-13-2013
Check these
https://www.unix.com/unix-dummies-que...-filename.html

https://www.unix.com/unix-dummies-que...-filename.html

Code:
user@Imperfecto_:~$ date -d last-sunday 
Sun Aug 11 00:00:00 IST 2013

Oh and I found these links using a magic trick aka "Search"!

--ahamed
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Not able to fetch previous month first date and last date

I am not able to fetch first date and last date previous month date -d -1month +%Y-%m-%d date -d -1month +%Y-%m-%d I need two format dd-mm-yyy previous month 01-03-2016 previous month 31-03-2016 and also only date 1 to 31 Aprriciate your replay (4 Replies)
Discussion started by: jagu
4 Replies

2. Shell Programming and Scripting

Help with getting last date of previous month and first date of previous 4th month from current date

I have requirment to get last date of previous month and the first date of previous 4th month: Example: Current date: 20130320 (yyyymmdd) Last date of previous month: 20130228 (yyyymmdd) First date of previous 4th month: 20121101 (yyyymmdd) In my shell --date, -d, -v switches are not... (3 Replies)
Discussion started by: machomaddy
3 Replies

3. Shell Programming and Scripting

Taking the count of sundays between two date ?

Hi Am using unix Ksh Datecalc and --date functions are not working have two input variables as DATE=01/12/2012 DATE1=23/12/2012 Need output as no of sundays = 4 Can anyone help me pls :( (2 Replies)
Discussion started by: Venkatesh1
2 Replies

4. Shell Programming and Scripting

Adding Previous Month To Filename

Dear experts, I'm using solaris 5.10 and bash. I want to zip file "Amount.txt" to "Amount.zip" and rename it to "Amount_<prev_month>_<this year>.zip". For example, file for this month should be renamed to "Amount_06_2012.zip", for next month it should be "Amount_07_2012.zip". I have no problem... (8 Replies)
Discussion started by: kris.adrianto
8 Replies

5. UNIX for Dummies Questions & Answers

Previous yearmonth in filename

Hi, I have a script that is looking for Files with a previous Year-month format. example if the script runs anyday in Oct2011 it has to look for Sept2011 files. it looks for FILENMAE_201109.TXT. I had used the code below and it works fine for many months but fails for Oct2011.. date... (2 Replies)
Discussion started by: rock1
2 Replies

6. Shell Programming and Scripting

finding the previous day date and creating a file with date

Hi guys, I had a scenario... 1. I had to get the previous days date in yyyymmdd format 2. i had to create a file with Date inthe format yyyymmdd.txt format both are different thanks guys in advance.. (4 Replies)
Discussion started by: apple2685
4 Replies

7. UNIX for Dummies Questions & Answers

Append Previous Days date to filename

I need to append previous days date to my file which is generated using a script. I am working on Solaris 10. Thanks! (2 Replies)
Discussion started by: Twisha
2 Replies

8. Shell Programming and Scripting

getting previous filename

hello experts, H r u . i just need to get the previous file from the latest file let say. fileA fileB fileC fileD fileE in this case fileE is the latest file but i need a script which will always get the name of the previouse file like fileD. currently i am using this command to get the... (3 Replies)
Discussion started by: shary
3 Replies

9. Shell Programming and Scripting

Specify a previous date as start date in shell script

Hi, I am trying to modify a script which accepts date in format dd/mm/yy. I am trying to modify the script so that it retrieves the date that was 15 days earlier from today as start date. Eg.if today is 05/09/2006, the script should retrieve 21/08/2006 as start date. Is there any script/code to... (2 Replies)
Discussion started by: ritzwan0
2 Replies

10. UNIX for Dummies Questions & Answers

Add date to a filename

Hi I want to add the date to a filename in a script I have. So I want exp myfile01-FEB-2005.dmp How do I get the 01-FEB-2005 in there? Cheers Rich (3 Replies)
Discussion started by: richard1975
3 Replies
Login or Register to Ask a Question