hi all,
my files look like this:
19.989182 -82.379220
19.983025 -82.377908
19.976869 -82.376596
19.970714 -82.375284
19.964563 -82.373970
19.958413 -82.372655
19.952262 -82.371340
19.946107 -82.370026
19.939946 -82.368713
19.933776 -82.367402
19.927602 -82.366093
19.921424 -82.364784
19.915240 -82.363478
-19.909052 -82.362174
-19.902864 -82.360870
-19.896679 -82.359566
-19.890500 -82.358260
-19.884328 -82.356951
-19.878167 -82.355641
-19.872018 -82.354330
-19.865890 -82.353016
-19.859783 -82.351702
-19.853688 -82.350387
19.835438 -82.346444
19.829359 -82.345131
19.823279 -82.343817
now, i want to cut this file, when the difference between the values of $1 is greater than 2 and write the lines up to this cut into a seperate file. e.g.
file 1:
19.989182 -82.379220
19.983025 -82.377908
19.976869 -82.376596
19.970714 -82.375284
19.964563 -82.373970
19.958413 -82.372655
19.952262 -82.371340
19.946107 -82.370026
19.939946 -82.368713
19.933776 -82.367402
19.927602 -82.366093
19.921424 -82.364784
19.915240 -82.363478
file 2:
-19.909052 -82.362174
-19.902864 -82.360870
-19.896679 -82.359566
-19.890500 -82.358260
-19.884328 -82.356951
-19.878167 -82.355641
-19.872018 -82.354330
-19.865890 -82.353016
-19.859783 -82.351702
-19.853688 -82.350387
file 3:
19.835438 -82.346444
19.829359 -82.345131
19.823279 -82.343817
$1 is always in ascending or descending order.
i tried so far:
awk 'NR>1{x=$1-y1;printf"%10.6f\t%10.6f\n",$1, $2, x{y3=$3}' infile > output
but this only finds the differences. can anybody help me?
thanks
my files look like this:
19.989182 -82.379220
19.983025 -82.377908
19.976869 -82.376596
19.970714 -82.375284
19.964563 -82.373970
19.958413 -82.372655
19.952262 -82.371340
19.946107 -82.370026
19.939946 -82.368713
19.933776 -82.367402
19.927602 -82.366093
19.921424 -82.364784
19.915240 -82.363478
-19.909052 -82.362174
-19.902864 -82.360870
-19.896679 -82.359566
-19.890500 -82.358260
-19.884328 -82.356951
-19.878167 -82.355641
-19.872018 -82.354330
-19.865890 -82.353016
-19.859783 -82.351702
-19.853688 -82.350387
19.835438 -82.346444
19.829359 -82.345131
19.823279 -82.343817
now, i want to cut this file, when the difference between the values of $1 is greater than 2 and write the lines up to this cut into a seperate file. e.g.
file 1:
19.989182 -82.379220
19.983025 -82.377908
19.976869 -82.376596
19.970714 -82.375284
19.964563 -82.373970
19.958413 -82.372655
19.952262 -82.371340
19.946107 -82.370026
19.939946 -82.368713
19.933776 -82.367402
19.927602 -82.366093
19.921424 -82.364784
19.915240 -82.363478
file 2:
-19.909052 -82.362174
-19.902864 -82.360870
-19.896679 -82.359566
-19.890500 -82.358260
-19.884328 -82.356951
-19.878167 -82.355641
-19.872018 -82.354330
-19.865890 -82.353016
-19.859783 -82.351702
-19.853688 -82.350387
file 3:
19.835438 -82.346444
19.829359 -82.345131
19.823279 -82.343817
$1 is always in ascending or descending order.
i tried so far:
awk 'NR>1{x=$1-y1;printf"%10.6f\t%10.6f\n",$1, $2, x{y3=$3}' infile > output
but this only finds the differences. can anybody help me?
thanks