Append Previous Days date to filename


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Append Previous Days date to filename
# 1  
Old 09-01-2010
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  
Old 09-01-2010
hi can you give an example of the output you are looking for??
Code:
lets just say your script's output file name is out_file
you can put this code in your script where its generating the file.
$ cat yestdate.ksh
#! /bin/ksh
TD=`date +%y%m%d`
YD=`TZ=CST+24 date +%y%m%d`
out_file = YDout_file


Last edited by Scott; 09-01-2010 at 07:49 AM..
This User Gave Thanks to dazdseg For This Post:
# 3  
Old 09-02-2010
Thanks!!
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to append date to filename, but base it on yesterday's date?

Hello, I'd like to write a monthly archive script that archives some logs. But I'd like to do it based on yesterday's date. In other words, I'd like to schedule the script to run on the 1st day of each month, but have the archive filename include the previous month instead. Here's what I... (5 Replies)
Discussion started by: nbsparks
5 Replies

2. Shell Programming and Scripting

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? (1 Reply)
Discussion started by: sswagner8839
1 Replies

3. Shell Programming and Scripting

Can i get the previous/next days date of a selected day

Ok, the title is confusing i know, but it is a weird question. I have a bash script running on Centos5.8 and want to find a better way to do some date manipulation. What i am trying to do is get 3 days of files (day before, that day, and day after), concatenate the three files and pass them on... (2 Replies)
Discussion started by: oly_r
2 Replies

4. Shell Programming and Scripting

Delete log files content older than 30 days and append the lastest date log file date

To delete log files content older than 30 days and append the lastest date log file date in the respective logs I want to write a shell script that deletes all log files content older than 30 days and append the lastest log file date in the respective logs This is my script cd... (2 Replies)
Discussion started by: sreekumarhari
2 Replies

5. Shell Programming and Scripting

append a filename with system date and time

Hi, There are similar kind of posts, but none seems like working for me. Please correct me if I'm wrong. I need append/rename file abc.txt with file processed date and time like abc_systemdatetimestamp.txt and move it to different folder. for example I have /source/data/abc.txt ... (1 Reply)
Discussion started by: amsn08
1 Replies

6. Shell Programming and Scripting

how to append current date to filename.tgz in perl

i would like to know how to append current date in a filename with .tgz extension. #!/usr/bin/perl my $date = `date + %Y%m%d`; system("sudo mv /tmp/nyucs01_config_backup.tgz /misc/nyucs01_config_backup_$date.tgz"); im getting this error message: sh: line 1: .tgz: command not found (7 Replies)
Discussion started by: linuxgeek
7 Replies

7. UNIX for Dummies Questions & Answers

Shell Scripts - Append a filename with date and time....

Hello, I need to create a shell script that appends a filename to create a name with the date and time appended that is guaranteed to not exist. That is, the script insures you will not overwrite a file with the same name. I am lost with this one. I know I need to use date but after that I am... (3 Replies)
Discussion started by: citizencro
3 Replies

8. UNIX for Dummies Questions & Answers

using 'date' to get previous days' dates

I am familiar with using the 'date' command to get the current date but I have a situation where I need to get the previous day's date as well as the date two days prior. Theoretically I could use 'expr' to compute these values but I need it to work in instances where the previous month's dates... (2 Replies)
Discussion started by: slant-40
2 Replies

9. UNIX for Dummies Questions & Answers

Append current date to filename

In C Shell programming I haven't successfully been able to append the date in the format mmddyyyy to a filename. I've tried the following: I can print out the date in the correct format: date +%x | sed ‘s/\///g I can create a variable with the filename: set newfile=changedfiles I can... (3 Replies)
Discussion started by: gigigi
3 Replies

10. UNIX for Dummies Questions & Answers

Append date to filename

What is the easiest way to append the date (year, month, day) to a filename? (5 Replies)
Discussion started by: hshapiro
5 Replies
Login or Register to Ask a Question