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 > Shell Programming and Scripting
.
google unix.com



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
rsh script with inside a for loop trekianov Shell Programming and Scripting 5 12-06-2008 12:39 PM
remsh inside of while loop joettacm UNIX for Advanced & Expert Users 1 12-07-2007 12:54 PM
Repetitive Tasks: using if..then inside a loop garak Shell Programming and Scripting 2 03-13-2006 07:36 AM
input inside while read loop jhansrod Shell Programming and Scripting 3 08-13-2005 10:46 AM
read inside a while loop dta4316 UNIX for Dummies Questions & Answers 3 05-21-2005 10:53 AM

Closed Thread
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 Rating: Thread Rating: 1 votes, 1.00 average. Display Modes
  #1 (permalink)  
Old 01-07-2008
panknil panknil is offline
Registered User
  
 

Join Date: Apr 2007
Location: Kolkata
Posts: 83
Thumbs up while loop inside while loop

Dear All,

i have a awk script where i'm using while loop inside while loop
here is the code:

awk -v DATE="$CURRDATE" -v -F'@' 'BEGIN {

while(( getline < "Merge_Calldet.txt" ))
{

ARR=$5
LINE=$0
while(( getline < "Merge_Accessnum.txt" ))
{
TESTSIMENTRY=$1
FILEDATE=$15
if ( TESTSIMENTRY == ARR )
{
FLAG=1
break
}
else
{
FLAG=0
continue
}

}
if (FLAG == 1)
{
print "Y" "@" FILEDATE "@" LINE
}
else
{
print "N" "@" DATE "@" LINE
}
}

}' >> Join_Calldt_Accnum.txt

I'm trying to compare 5th field of Merge_Calldet.txt with the fisrt field of Merge_Accessnum.txt.
means it will take 5th field from first line of Merge_Calldet.txt and will compare of entire first field of Merge_Accessnum.txt file.
again it will take the 5th field from second line of Merge_Calldet.txt and so on.
but the problem is in the flow is coming inside the second while loop only for one tiime.
can anyone plz suggest me the mistake i have done.

Thanks,
Regards,
Pankaj
Sponsored Links
Closed Thread

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 03:16 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