problem here is I could not able to trace where internal loop is ending and where outer loop is ending .
here it was suppose to do like this repeat following statements 2440 times, after that come out of loop, print if statement is true else increment outer loop(i).. again repeat following statements 2440 times...
What immediately jumps to my eyes (after rearranging / indenting your code for better readability) is that your first for loop sets x=0 217 times, then y=0 once, then continues to the rest:
Code:
END {for(i=1;i<=217;i++) # For loop 2nd File 1st and 2nd column
x=0;y=0 # Intialize x and y value 0
{for(j=1;j<=2440;j++) # For loop for 1st file 1st and 2nd column
if(A[1,j,2]>=A[2,i,2]-0.1 && A[1,j,2]<=A[2,i,2]+0.1) # Comparison starts here
{if(A[1,j,1]>=A[2,i,1])x=x+1;
if(A[1,j,1]<=A[2,i,1])y=y+1;
}
} # Internal loop ends here
if(x>=1 && y>=1) print i, j, A[2,i,1], A[2,i,2]
}
You want to move that second opening brace in front of the x assignment and retry...
Hi Gurus,
I run command grep ABC file1 > file2 against below file. I got all ABC_xxx in one line in file2. I expect to get multiple lines in file2. If I print result in screen, the result is expected.
thanks in advance
My os is SunOS 5.10 Generic_150400-64 sun4v sparc sun4v
ABC_123
XXXXX... (2 Replies)
Hi Experts,
I have written the below script but its not working as per expectation.
My requirement is if this condition ] is satisfied
then only check for this condition ] if this also satisfied check for the condition ].
vi p_values.ksh
path="/db/ora/files"
mode=1
b_days=10... (5 Replies)
Hello,
I am trying to print out the first string matching query with grep and I need your help.
My scenario:
Database
John F
4433 Street No 88 CA
Elisabeth Taylor
7733 Street No 26 ON
Jack Nicholson
0133 Green Park No 34 AR
John F 2
9399 Southpark No 02D UT
test.sh... (6 Replies)
I have the data like this:
PONUMBER,SUPPLIER,LINEITEM,SPLITLINE,LINEAMOUNT,CURRENCY
IR5555,Supplier1,1,1,83.1,USD
IR5555,Supplier1,1,3,40.4,USD
IR5555,Supplier1,1,6,54.1,USD
IR5555,Supplier1,1,8,75.1,USD
IR5556,Supplier2,1,1,41.1,USD
IR5556,Supplier2,1,3,43.1,USD
... (3 Replies)
I have five classes. 2 composition classes,1 aggregation class and 1 dependency class.I have coded all the classes but one of my test program is not giving me the expected result.I have the following classes:
TimeStamp
Interval (composition of 2 TimeStamps)
TimeSheet ( aggregation of many... (3 Replies)
I'm trying to parse a configuration text file using awk. The following is a sample from the file I'm searching. I can retrieve the formula and recipe names easily but now I want to take it one step farther. In addition to the formula name, I would like to also get the value of the attribute... (6 Replies)
Hi frnds...
I m facing very irritating problem already waisted my 2 days..
I have a following script..( i am pasting only the main code)
ftp -ivn 213.194.40.77 <<FTP
user $user $password
binary
cd $FileDir/out
lcd $localpath
get $file
rename $FileDir/out/$file $FileDir/tmp/$file... (1 Reply)
Can somebody give me a cleaner way of writing the following script. I was thinking that I could use a loop in the awk statement. It works fine the way it is but I just want the script to be cleaner.
#!/usr/bin/sh
for r in 0 1 2 3 4 5 6
do
DAY=`gdate --date="${r} days ago" +%m\/%d\/%y`... (3 Replies)