Hello,
I'm trying to write an awk program that reads two files inputs.
example,
file 1:
0.00017835
0.000176738
0.00018811
0.000189504
0.000188155
0.000180065
0.000178991
0.000178252
0.000182513
file 2:
1.7871769E-05 1.5139576E-16 1.5140196E-16 1.5139874E-16
1.7827407E-04 1.6709859E-18 1.6950919E-18 1.6897323E-18
1.7830577E-04 1.6709414E-18 1.6843205E-18 1.6807697E-18
1.7833745E-04 1.6709859E-18 1.6843205E-18 1.6807697E-18
1.7836914E-04 1.6709859E-18 1.6843205E-18 1.6807697E-18
1.7840082E-04 1.6717005E-18 1.6800867E-18 1.6807697E-18
1.7843251E-04 1.6717005E-18 1.6800867E-18 1.6807697E-18
1.7846419E-04 1.6717005E-18 1.6800867E-18 1.6897323E-18
1.7849589E-04 1.6826009E-18 1.6800867E-18 1.6897323E-18
1.7852758E-04 1.6891735E-18 1.6843205E-18 1.6897323E-18
1.7855926E-04 1.6943236E-18 1.6800867E-18 1.6897323E-18
1.7881277E-04 1.6891735E-18 1.6609087E-18 1.6604721E-18
1.7884445E-04 1.6891735E-18 1.6565899E-18 1.6604721E-18
1.7887614E-04 1.6826009E-18 1.6494530E-18 1.6547480E-18
1.7890782E-04 1.6891735E-18 1.6494530E-18 1.6547480E-18
1.7893952E-04 1.6943236E-18 1.6494530E-18 1.6547480E-18
1.7897120E-04 1.6891735E-18 1.6462933E-18 1.6532895E-18
1.7900289E-04 1.6891735E-18 1.6462933E-18 1.6532895E-18
1.7903457E-04 1.6826009E-18 1.6462933E-18 1.6532895E-18
1.7906626E-04 1.6717005E-18 1.6394092E-18 1.6475811E-18
1.7909794E-04 1.6826009E-18 1.6462933E-18 1.6475811E-18....
where file 2 is much bigger than the file1 and the first column is in descending order.
The problem is that I want every value in file1 to go to the list in file2 and stop until the value in file1 is greater than or equal to that of file2's first column and output the whole row to a new file. Taking in consideration that file2 will contain more data ranging for all values that will be in file1
this is what I have so far but is not working:confused:
awk 'NR>=FNR{value = $1} {if(value>$1){print $1};next}' file1 file2 > file3