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).

Assignment 2 and Clarifications.
RSS cloud
Jump to:

Assign 2, Q3 - haversine.awk implementations

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

"David Tang"                               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, 3:46pm, David T.
├─ THIS   Mon 18th May, 3:53pm, Christopher M.
└─ reply 2   Mon 18th May, 11:38pm, David M.
This Page

Program written by: [email protected]
Feedback welcome
Last modified:  8:27am May 24 2020