Find and Create by Date


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Find and Create by Date
# 1  
Old 08-19-2008
Find and Create by Date

I have a log file that's generated on a daily basis, and saved with the Month and day at the end of it. For instance: file_type_Aug17.csv. As part of my excel conversion I need my script to search for the current Month and day(Aug17) and convert it. Thanks for your help!
# 2  
Old 08-19-2008
you mean you wanna convert your file to .csv format??
date "+%m"=Aug
date "+%d"=17
concate them you get Aug17 then search using find command or grep it then convert it..
give it a try.. if not possible we will help you out..
# 3  
Old 08-20-2008
Thanks for your help!

Here's what I have so far.

rm -rf file_file_perf_Aug18.xls
chmod 777 file_file_perf_Aug19.csv
awk -f csc2xls < file_file_perf_Aug19.csv > file_file_perf_Aug19.xls
chmod 777 file_file_perf_Aug19.xls
I have to manually change the number in the date to complete the task. I indicated in the original post the current Month and day. My mistake, not the current day, I need to this script find the day before. Thanks
# 4  
Old 08-20-2008
try changing TZ
echo "$TZ"
if it shows TZ=IST-5:30
change it to TZ=IST-24
then type date you get next date then extract date in whichever way you want and search using that.. for you file..
# 5  
Old 08-20-2008
echo "$TZ" works for me and the result is US/Eastern

Since I'm new to this, in my script what should be my layout.
Here's what I'm trying to accomplish.

I'm trying to automate this as much as possible. These reports are generated the day before. Now in the morning 12AM the next day I need to email an excel formatted report to the heads.

the system generates a csv file that is -rw-r--r--, I normally have to chmod to perform execute.

How would I implemented the date portion into my script to pull or parse the correct file with the naming convention I provided?
# 6  
Old 08-20-2008
Code:
CURRENT_DATE=`date +%Y%m%d`
echo "$CURRENT_DATE"
OLD1=`date +%d`
OLD2=`expr $OLD1 - 1`
OLD_ONE=`date +%Y%m`$OLD2
echo"$OLD_DATE"

See if this helps you to get previous date.

- nilesh
# 7  
Old 08-21-2008
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
 
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