Question: Using gawk Consider the following file called coords.txt : x1 y1 x2 y2 0.0 0.0 0.4 1.0 0.5 0.1 -0.25 0.9 0.75 0.4 -2.5 2.2

Using gawk

Consider the following file called coords.txt:

x1 y1 x2 y2

0.0 0.0 0.4 1.0

0.5 0.1 -0.25 0.9

0.75 0.4 -2.5 2.2

1.0 1.3 -1.0 4.2

Each field in this file is separated by a tab and each record is separated by a newline character. gawk is a very powerful utility; it can make calculations as well as support branching statements and function calls. Now write a one-line gawk script that computes the distance between each pair of points . Hint: gawk supports the sqrt function! Obviously, you need to skip the first line (i.e., the header) and only print out four values, the first of which is 1.07703.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!