Results 1 to 4 of 4
  1. #1
    Join Date
    Oct 2003
    Posts
    5

    Unanswered: 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?

  2. #2
    Join Date
    Aug 2001
    Location
    UK
    Posts
    4,650

    Re: awk script is hanging

    Absolutely not ...

    Do you want to post your script ?

    Cheers
    Sathyaram

    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.

  3. #3
    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 08:40.

  4. #4
    Join Date
    Oct 2003
    Posts
    5
    i've found the answer to my problem. wasn't the awk script at all.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •