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 05:44 AM
date issue-find prevoius date in a patricular format bsandeep_80 UNIX for Advanced & Expert Users 3 11-15-2007 08:42 PM
Need help to create a date script mredwardlee Shell Programming and Scripting 6 10-20-2006 11:00 AM
Directory create date Bab00shka UNIX for Dummies Questions & Answers 2 06-29-2005 11:42 AM
How to find Previous date and Coming date arunava_maity UNIX for Dummies Questions & Answers 2 05-24-2001 12:41 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 08-19-2008
ravzter ravzter is offline
Registered User
  
 

Join Date: Jul 2008
Posts: 20
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 (permalink)  
Old 08-19-2008
vidyadhar85's Avatar
vidyadhar85 vidyadhar85 is offline Forum Staff  
Moderator(The Tutor)
  
 

Join Date: Jun 2008
Location: INDIA
Posts: 1,400
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 (permalink)  
Old 08-20-2008
ravzter ravzter is offline
Registered User
  
 

Join Date: Jul 2008
Posts: 20
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 (permalink)  
Old 08-20-2008
vidyadhar85's Avatar
vidyadhar85 vidyadhar85 is offline Forum Staff  
Moderator(The Tutor)
  
 

Join Date: Jun 2008
Location: INDIA
Posts: 1,400
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 (permalink)  
Old 08-20-2008
ravzter ravzter is offline
Registered User
  
 

Join Date: Jul 2008
Posts: 20
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 (permalink)  
Old 08-20-2008
ynilesh's Avatar
ynilesh ynilesh is offline
Registered User
  
 

Join Date: Oct 2007
Location: Bangalore, India.
Posts: 222
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 (permalink)  
Old 08-21-2008
ravzter ravzter is offline
Registered User
  
 

Join Date: Jul 2008
Posts: 20
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
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 07:40 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0