![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| 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 !! |
|
|
||||
| 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 |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
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!
|
| Forum Sponsor | ||
|
|
|
#2
|
||||
|
||||
|
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
|
|||
|
|||
|
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
|
||||
|
||||
|
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
|
|||
|
|||
|
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
|
||||
|
||||
|
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" - nilesh |
|
#7
|
|||
|
|||
|
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 |
|||
| Google The UNIX and Linux Forums |