If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Unix Shell Scripts > awk script is hanging

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-20-03, 13:50
deg deg is offline
Registered User
 
Join Date: Oct 2003
Posts: 5
awk script is hanging

newbie question--

have an awk script that works correctly except that i have to break it. seems like it's hanging waiting for some input. anyone have an idea what i'm missing?
Reply With Quote
  #2 (permalink)  
Old 11-20-03, 19:44
sathyaram_s sathyaram_s is offline
Super Moderator
 
Join Date: Aug 2001
Location: UK
Posts: 4,543
Re: awk script is hanging

Absolutely not ...

Do you want to post your script ?

Cheers
Sathyaram

Quote:
Originally posted by deg
newbie question--

have an awk script that works correctly except that i have to break it. seems like it's hanging waiting for some input. anyone have an idea what i'm missing?
__________________
Visit the new-look IDUG Website , register to gain access to the excellent content.
Reply With Quote
  #3 (permalink)  
Old 11-21-03, 07:31
deg deg is offline
Registered User
 
Join Date: Oct 2003
Posts: 5
Re: awk script is hanging

here it is:

BEGIN {bar="";cnt=0;hdr=1}
{
if($1==bar)
{stuff[++cnt]=$0}
else
{if(NR==1)
{stuff[++cnt]=$0}}
}
{
if($1!=bar)
if(cnt>2) if(NR>1) {print bar,cnt >> "clms";tcnt=tcnt+cnt}}
else
{if(NR>1) {for(r in stuff) print stuff[r] >> "dummy"}}
}
{
if($1!=bar)
{if(NR>1) {for(r in stuff) delete stuff[r];cnt=1;stuff[cnt]=$0}}
}
{bar=$1}
END{
if(cnt>2) print bar,cnt " lines." >> "clms";
else for(r in stuff) print stuff[r] >> "dummy"
}

Last edited by deg; 11-21-03 at 07:40.
Reply With Quote
  #4 (permalink)  
Old 11-21-03, 09:12
deg deg is offline
Registered User
 
Join Date: Oct 2003
Posts: 5
i've found the answer to my problem. wasn't the awk script at all.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On