Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
executable file 4 lines (3 sloc) 238 Bytes
#!/bin/bash
#
/usr/bin/perl -ane 'if($a){$x1=$x2;$y1=$y2;}else{$f=$F[1];$ff=$F[2];}if (/point/){$x2=$F[1];$y2=$F[2];$a++;}if($a) {$cd+=sqrt(($x2-$x1)**2 + ($y2-$y1)**2);} if(eof){$cd+=sqrt(($f-$x2)**2 + ($ff-$y2)**2);print $cd,"\n";}' $1