![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to get yesterdays julian date | er_ashu | UNIX for Dummies Questions & Answers | 3 | 01-24-2009 01:20 PM |
| convert Julian date to calender date | srikanthus2002 | Shell Programming and Scripting | 6 | 05-08-2007 07:27 AM |
| Find julian date for given corresponding date | srikanthus2002 | Shell Programming and Scripting | 2 | 10-10-2006 10:33 PM |
| Calendar date to Julian and Back | BCarlson | Shell Programming and Scripting | 4 | 05-14-2005 06:18 PM |
| Julian Date | lesstjm | Shell Programming and Scripting | 3 | 04-17-2003 04:39 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
need help using find and date (julian)
I'm trying to put together a little script that will move some files to a directory, uncompress the file then delete the file when processing is complete.
The files are all named using julian date 2009072.Z 2009071.Z 2009070.Z 2009069.Z 2009068.Z 2009067.Z 2009066.Z 2009065.Z 2009064.Z 2009063.Z 2009062.Z 2009061.Z 2009060.Z 2009059.Z 2009058.Z 2009057.Z each day the oldest file falls off and the next day takes the lead. I'm trying to find a way that will find the file with todays julian date, cp to another directory, uncompress, run another script on this uncompressed file, delete the file and then return to master directory to copy the next file over. I can't mass cp the files because of size restrictions so I have to handle each file one at a time. Thoughts or ideas would be very appreciated. Thanks! |
|
||||
|
From today -> files in the past for one year.
Code:
cd /someplace
start=$( date +%Y%03j )
stop=$( date +%Y000 )
while [[ $start -gt $stop ]]
{
if [[ -f ${start}.Z ]] ; then
cp ${start}.Z /anotherplace
my_other_script.sh /anotherplace/${start}.Z
rm -f /anotherplace/${start}.Z
start=$(( $start - 1 ))
else
echo "${start}.Z not found .. skipping on to the next file "
fi
}
|
|
||||
|
here is what I'm working with now...
Code:
cd /cms/ech_data/archive
start=$( date +%Y%j )
stop=$( date +%Y000 )
while [[ $start -gt $stop ]]
do
cp ${start}.Z ../recovery
cd ../recovery
uncompress ${start}.Z
cpio -ivm < ${start}
rm ${start}
* touch this is an error also touch [filename] is the syntax
for file in `ls chr*`
do
/export/home/ech/OA_resend $file
echo $file
rm $file
done
start=$(( $start - 1 ))
done
this script generates this error syntax error at line 10 : `while' unmatched Last edited by jim mcnamara; 03-16-2009 at 12:32 PM.. |
|
||||
|
thanks... I'm still missing something and I can't see what it is...
I'm trying to run the script in debug mode -x but it looks like I need to insert some pauses so I can read what the output is... How can I pause the script at different points in the script? |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|