The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
want to create directory with the previous date sridhusha Shell Programming and Scripting 7 11-19-2007 02:44 AM
date issue-find prevoius date in a patricular format bsandeep_80 UNIX for Advanced & Expert Users 3 11-15-2007 05:42 PM
Need help to create a date script mredwardlee Shell Programming and Scripting 6 10-20-2006 07:00 AM
Directory create date Bab00shka UNIX for Dummies Questions & Answers 2 06-29-2005 07:42 AM
How to find Previous date and Coming date arunava_maity UNIX for Dummies Questions & Answers 2 05-24-2001 08:41 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 08-18-2008
Registered User
 

Join Date: Jul 2008
Posts: 17
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!
Reply With Quote
Forum Sponsor
  #2  
Old 08-18-2008
vidyadhar85's Avatar
The Tutor
 

Join Date: Jun 2008
Location: INDIA
Posts: 547
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..
Reply With Quote
  #3  
Old 08-20-2008
Registered User
 

Join Date: Jul 2008
Posts: 17
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
Reply With Quote
  #4  
Old 08-20-2008
vidyadhar85's Avatar
The Tutor
 

Join Date: Jun 2008
Location: INDIA
Posts: 547
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..
Reply With Quote
  #5  
Old 08-20-2008
Registered User
 

Join Date: Jul 2008
Posts: 17
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?
Reply With Quote
  #6  
Old 08-20-2008
ynilesh's Avatar
Registered User
 

Join Date: Oct 2007
Location: Bangalore, India.
Posts: 174
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
Reply With Quote
  #7  
Old 08-21-2008
Registered User
 

Join Date: Jul 2008
Posts: 17
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
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 09:00 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0