Find and Create by Date


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Find and Create by Date
# 8  
Old 08-21-2008
Quote:
Originally Posted by ravzter
Thanks!

This portion of the script is displaying
bash-3.00$ CURRENT_DATE='date + %Y%m%d'
bash-3.00$ echo "$CURRENT_DATE"

this output
date + %Y%m%d
bash-3.00$ CURRENT_DATE='date + %Y%m%d' don't use ' use `
# 9  
Old 08-22-2008
Nothing is being displayed

$ CURRENT_DATE=`date + %Y%m%d`
$ echo "$CURRENT_DATE"

$
Thanks!
# 10  
Old 08-22-2008
Quote:
Originally Posted by ravzter
Nothing is being displayed

$ CURRENT_DATE=`date + %Y%m%d`
$ echo "$CURRENT_DATE"

$
Thanks!
oh ho..
use this....
Quote:
CURRENT_DATE=`date "+%Y%m%d"`
echo "$CURRENT_DATE"
# 11  
Old 08-22-2008
Excellent it works!

I've modified the whole script, but I'm not getting the final result.

bash-3.00$ CURRENT_DATE=`date "+%Y%m%d"`
bash-3.00$ echo "$CURRENT_DATE"
20080822
bash-3.00$ OLD1=`date "+%d"`
bash-3.00$ OLD2=`expr $OLD1 - 1`
bash-3.00$ OLD_ONE=`date "+%Y%m"`$OLD2
bash-3.00$ echo"$OLD_DATE"

bash-3.00$

Is possible to ouput the shortname version of the month? Like Jan, Feb, Aug.

Thanks!

Last edited by ravzter; 08-22-2008 at 05:32 AM..
# 12  
Old 08-22-2008
echo `date +"%b"`
# 13  
Old 08-25-2008
I've tried the code below, but I not getting anything. Please help!

CURRENT_DATE=`date "+%m%d%Y"`
echo "$CURRENT_DATE"
OLD1=`date "+%d"`
OLD2=`expr $OLD1 - 1`
OLD_ONE=`date "+%Y%d"`
echo"$OLD_ONE"

rm -rf *.xls
chmod 777 file_file_file_OLD_ONE.csv
awk -f csc2xls < file_file_file__OLD_ONE.csv > file_file_file_OLD_ONE.xls
chmod 777 file_file_file_OLD_ONE.xls
# 14  
Old 08-26-2008
Problem solved! Thanks for all your help!

How would I export the excel version into a Windows env for further processing?


CURRENT_DATE=`date "+%b%d"`
echo "$CURRENT_DATE"
OLD1=`date "+%b"`
OLD2=`expr "$OLD1 - 1"`
OLD_ONE=`date "+%b%Y"`$OLD2
echo"$OLD_DATE"


CURRENT_DATE=`date "+%b%d%Y"`
echo "$CURRENT_DATE"
OLD1=`date "+%d"`
OLD2=`expr $OLD1 - 1`
OLD_ONE=`date "+%b"`$OLD2
echo "$OLD_ONE"
rm -rf *.xls
chmod 777 file_file_perf_$OLD_ONE.csv
awk -f csc2xls < file_file_perf_$OLD_ONE.csv > file_file_perf_$OLD_ONE.xls
chmod 777 file_file_perf_$OLD_ONE.xls
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Replacing Date in the file with Create date and timestamp

Hello, I have files that with a naming convention as shown below. Some of the files have dates in the file name and some of them don't have dates in the file name. imap-hp-import-20150917.txt imap-dell-gec-import-20150901.txt imap-cvs-import-20150915.txt imap-gec-import.txt... (8 Replies)
Discussion started by: Saanvi1
8 Replies

2. UNIX for Dummies Questions & Answers

Find the count of files by last created date based on the given date range

My unix version is IBM AIX Version 6.1 I tried google my requirement and found the below answer, find . -newermt “2012-06-15 08:13" ! -newermt “2012-06-15 18:20" But newer command is not working in AIX version 6.1 unix I have given my requirement below: Input: atr files: ... (1 Reply)
Discussion started by: yuvaa27
1 Replies

3. 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

4. Shell Programming and Scripting

How to create variable from date

I have a requirement to send a trigger file (trigger_dayn.dat) to a remote server through the FTP trigger_dayn.dat - here the dayn is the day number. However the dayn is not sysdate. day 1 is from Monday 07:00.00 AM to Tuesday 06:59:59 AM and so on. So if the trigger file is generated say... (1 Reply)
Discussion started by: k_vikash
1 Replies

5. Shell Programming and Scripting

How to find the create time of a file if current date is in next month

Hi All, I want to find the time diffrence between currnt time and "abc.txt" file create time. I have solve that but if the abc.txt file created last month then is there any process to find the difftent? Exp: Create time of abc.txt is "Apr 14 06:48" and currect date is "May 17 23:47".... (1 Reply)
Discussion started by: priyankak
1 Replies

6. Shell Programming and Scripting

How to find a date which is 7 days past when given current date

hii all. I have to get the date of the 7th day past from the current date. if i give the current date as sep 3 then i must get the date as 27th of august. can we get the values from the "cal" command. cal | awk '{print $2}' will this type of command work. actually my need is if today is... (17 Replies)
Discussion started by: ladtony
17 Replies

7. UNIX for Advanced & Expert Users

date issue-find prevoius date in a patricular format

Hi , I have written a shell script that takes the current date on the server and stores it in a file. echo get /usr/home/data-`date '+%Y%d'`.xml> /usr/local/sandeep/GetFILE.ini I call this GetFILE.ini file from an sftp program to fetch a file from /usr/home/ as location. The file is in... (3 Replies)
Discussion started by: bsandeep_80
3 Replies

8. Shell Programming and Scripting

Need help to create a date script

So I need to create a shell script that can take as input a numeric day, month and year and output the day of the week for the input date. So let's say, I input "programname 19 10 2006" it should output Thursday... I tried messing around with the grep and awk commands, but I can't get it to... (6 Replies)
Discussion started by: mredwardlee
6 Replies

9. UNIX for Dummies Questions & Answers

Directory create date

Hi, How do you find the create date of a directory? I can see the modification date using ls -l but I'm looking for the create date. Many thanks Helen (2 Replies)
Discussion started by: Bab00shka
2 Replies

10. UNIX for Dummies Questions & Answers

How to find Previous date and Coming date

Hi All, How to find a date which is 7 days from the current date as well as how to find a date which is 7 days before this current date. Urgently i need help. Thanks in Advance Regards Arunava (2 Replies)
Discussion started by: arunava_maity
2 Replies
Login or Register to Ask a Question