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

help4407


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

Assignment 2 and Clarifications.
 
Options:
RSS cloud
Jump to:

Assign 2, Q3 - haversine.awk implementations

3 of 390 articles shown, currently no other people reading this forum.
photo
From: David T.
Date: Mon 18th May, 3:46pm
Actions: 
        Login-to-reply
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

Where am I going wrong?

Thanks,
David

Assign 2, Q3 - haversine.awk implementations

photo
From: Christopher M.
Date: Mon 18th May, 3:53pm
Actions: 
        Login-to-reply
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.

Assign 2, Q3 - haversine.awk implementations

photo
From: David M.
Date: Mon 18th May, 11:38pm
Actions: 
        Login-to-reply
I modified the supplied haversine.awk file slightly by removing the file processing
statements to make it a pure function. Then I include it my own AWK program. It's
more useful that way.
This Page


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