Faculty of Engineering and Mathematical Sciences 
Not logged in (login)


This forum is provided to promote discussion amongst students enrolled in Open Source Tools and Scripting (CITS4407).
RSS cloud
Jump to:

Assign 2, Q3 - haversine.awk implementations

1 of 390 articles shown, currently no other people reading this forum.
From: Christopher M.
Date: Mon 18th May 2020, 3:53pm


Hi David,

"David Tang" <22*7*2*[email protected]*u*e*t*u*a*e*u*a*> wrote:

> Hi Chris,
> I'm having trouble implementing 'haversine.awk' in bash.
>  From the forums I've read, this syntax should work? 
> echo | awk -v lat1=$1 -v lon1=$2 -v lat2=-31.97156055555560 -v lon2=115.902151666667 -f 
> haversine.awk

No quite;  it's a shellscript (executed by bash) that immediately (and only) calls awk.

make it executable, and then run:

  ./haversine.awk -31.8 116.0 -31.9 115.9

As provided, it reads the lats+lons from command-line arguments, but you may wish to modify the 
script for them to be read from standard input.

Related articles

Assign 2, Q3 - haversine.awk implementations (all 3) RSS
├─ original   Mon 18th May 2020, 3:46pm, David T.
├─ THIS   Mon 18th May 2020, 3:53pm, Christopher M.
└─ reply 2   Mon 18th May 2020, 11:38pm, David M.
This Page

Program written by: [email protected]
Feedback welcome
Last modified:  2:34pm Sep 18 2020