The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users
.
google unix.com



UNIX for Advanced & Expert Users Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Nagios escalating prematurely apatil Linux 0 08-12-2009 03:29 AM
nanosleep returns prematurely, with return value 0 MeMyself High Level Programming 1 12-21-2008 11:22 PM
perl script dies altogether when I put an & after it hairytorus UNIX for Dummies Questions & Answers 2 08-01-2008 03:49 PM
script to change default route when primary gateway dies slacker Shell Programming and Scripting 0 05-24-2006 12:34 PM
Why does rexec cause while loop to end prematurely? sadove Shell Programming and Scripting 2 02-23-2005 04:19 PM

Reply
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 09-29-2009
mlw63@me.com mlw63@me.com is offline
Registered User
  
 

Join Date: Sep 2009
Posts: 1
script dies prematurely and unpredictably

Hi,

I have over 5 gb of data in a files structure in which month folders are in year folders, day folders are in month folders, and individual climate stations are in each day. I am trying to extract precipitation measured at 5 minute intervals for a duration of 15 years, but the script never gets beyond the fifth year. I have run it many many times in Snow Leopard Terminal 2.1 (272). It stops at:
+ echo STIL 89 570 85 13.5 0.7 0.7 137 5.0 0.2 1.0 0.00 -999.00 1 14.4 0.0 15.6 18.2 15.4 16.5 15.8

Here is the script:
#!/bin/ksh -x
Myoutput=/MyOutput/MyOutput_$$.txt
cd ../wine
# takes output of ls command and pass to next line

ls |\

while read nextyear

do
Year=${nextyear}
cd ${nextyear}
ls |\
while read nextmonth
do
Month=${nextmonth}
cd ${nextmonth}
ls |\
while read nextday
do
Day=${nextday}
cd ${nextday}
ls | grep stil | xargs grep -i stil |\
while read nextline
do



Stid=`echo ${nextline} | awk '{print $1}'`
Time=`echo ${nextline} | awk '{print $3}'`
Rain=`echo ${nextline} | awk '{print $12}'`
echo ${Stid} ${Year} ${Month} ${Day} ${Time} ${Rain} >> $Myoutput

done


cd ..
done
cd ..
done
cd ..
done

This is how the output is supposed to look:
STIL 1994 01 01 0 0.00
STIL 1994 01 01 5 0.00
STIL 1994 01 01 10 0.00
STIL 1994 01 01 15 0.00
STIL 1994 01 01 20 0.00
STIL 1994 01 01 25 0.00
STIL 1994 01 01 30 0.00
STIL 1994 01 01 35 0.00
STIL 1994 01 01 40 0.00
STIL 1994 01 01 45 0.00
STIL 1994 01 01 50 0.00
STIL 1994 01 01 55 0.00
STIL 1994 01 01 60 0.00
STIL 1994 01 01 65 0.00
STIL 1994 01 01 70 0.00
STIL 1994 01 01 75 0.00
STIL 1994 01 01 80 0.00
STIL 1994 01 01 85 0.00
STIL 1994 01 01 90 0.00
STIL 1994 01 01 95 0.00
STIL 1994 01 01 100 0.00
STIL 1994 01 01 105 0.00
STIL 1994 01 01 110 0.00
STIL 1994 01 01 115 0.00
STIL 1994 01 01 120 0.00
STIL 1994 01 01 125 0.00
STIL 1994 01 01 130 0.00
STIL 1994 01 01 135 0.00
STIL 1994 01 01 140 0.00
STIL 1994 01 01 145 0.00
STIL 1994 01 01 150 0.00
STIL 1994 01 01 155 0.00
STIL 1994 01 01 160 0.00
STIL 1994 01 01 165 0.00
STIL 1994 01 01 170 0.00
STIL 1994 01 01 175 0.00
STIL 1994 01 01 180 0.00
STIL 1994 01 01 185 0.00
STIL 1994 01 01 190 0.00
STIL 1994 01 01 195 0.00
STIL 1994 01 01 200 0.00
STIL 1994 01 01 205 0.00
STIL 1994 01 01 210 0.00
STIL 1994 01 01 215 0.00
STIL 1994 01 01 220 0.00
STIL 1994 01 01 225 0.00
STIL 1994 01 01 230 0.00
STIL 1994 01 01 235 0.00
STIL 1994 01 01 240 0.00
STIL 1994 01 01 245 0.00
STIL 1994 01 01 250 0.00
STIL 1994 01 01 255 0.00
STIL 1994 01 01 260 0.00

Any ideas? I just need it to run through 10 more years of data!

Thanks!
  #2 (permalink)  
Old 09-30-2009
dr.house dr.house is offline
Registered User
  
 

Join Date: Dec 2008
Location: Switzerland
Posts: 225
You may want to

- process the years one by one, than concatenate the filed results;
- go find some freak with a more powerful machine running idle
  #3 (permalink)  
Old 09-30-2009
Shazin Shazin is offline
Registered User
  
 

Join Date: Jul 2009
Location: Gurgaon, India
Posts: 77
Hi,

Please can you run the script in the background and provide us with the details of

Code:
vmstat 2 10
Cheers,
Shazin
Reply

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 09:28 PM.


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