Re: Awk not ouputting results via echo

2015-11-24 Thread cyg Simple
On 11/23/2015 10:11 AM, Lester Anderson wrote: > Hello, > > The img2grd program is a Windows code. The script is using the GMT Which is the cause of any PTY issue. > software that is freely available, and accessed via Cygwin; can also > work via standard windows batch files to a more restricted

Re: Awk not ouputting results via echo

2015-11-24 Thread Lester Anderson
Thanks for all the pointers on this query. I applied the method of Eliot and managed to get the output and grids generated with the spatial adjustment: #!/bin/bash ruta_elev="Q:\geophys\Potential-field datasets\Topography\topo_17.1.img" ruta_grav="Q:\geophys\Potential-field datasets\Gravity\grav.i

Re: Awk not ouputting results via echo

2015-11-23 Thread Lee
On 11/23/15, Lester Anderson wrote: > Hello, > > Having sorted how to access a separate drive location, I have expanded > the script to include an awk section which processes new coordinate > limits which should pass to img2grd to extract the data grids. > However, the awk scripting does not seem

Re: Awk not ouputting results via echo

2015-11-23 Thread Eliot Moss
On 11/23/2015 11:24 AM, Lester Anderson wrote: Hi Eliot, I can see the logic of the function, but not sure how it is implemented from the section I have: This has to do with bash and shells in general, and is not specific to awk or to the cygwin Unix-like environment. But what I meant was som

Re: Awk not ouputting results via echo

2015-11-23 Thread Lester Anderson
As a test I did a simple function to read the inputs: #!/bin/sh lon_min=-12 lon_max=0 lat_min=28 lat_max=39 R_d=167 R_i=20 function Test() { echo Test function: $lon_min $lon_max $lat_min $lat_max $R_d $R_i } # Test > test.txt # test.txt -> -12 0 28 39 167 20 Still needs awk to do those

Re: Awk not ouputting results via echo

2015-11-23 Thread Lester Anderson
Hi Eliot, I can see the logic of the function, but not sure how it is implemented from the section I have: lon_min=-12 lon_max=0 lat_min=28 lat_max=39 R_d=167 R_i=20 echo $lon_min $lon_max $lat_min $lat_max $R_d $R_i | awk "{R_t=6370; pi=3.14159; lat_av=(($lat_max+$lat_min)/2)*(pi/18

Re: Awk not ouputting results via echo

2015-11-23 Thread Eliot Moss
Ok, I think I have a sense of an underlying problem here. When you do: ... | read v1 v2 ... The read executes in an inferior process, setting variables there. The process then exits and you have no bindings in the parent shell, which is where you want them. Maybe something like this would suit

Re: Awk not ouputting results via echo

2015-11-23 Thread Lester Anderson
Hello, The img2grd program is a Windows code. The script is using the GMT software that is freely available, and accessed via Cygwin; can also work via standard windows batch files to a more restricted degree. The Windows path definition worked fine, thanks for that The issue seems to be getting

Re: Awk not ouputting results via echo

2015-11-23 Thread cyg Simple
On 11/23/2015 8:17 AM, Lester Anderson wrote: > > #!/bin/bash > ruta_elev="Q:/geophys/Potential-field datasets/Topography/topo_17.1.img" > ruta_grav="Q:/geophys/Potential-field datasets/Gravity/grav.img.23.1" This response is based on your subsequent email but what if you change Q: to be /cygdriv

Re: Awk not ouputting results via echo

2015-11-23 Thread Lester Anderson
The error when run is: ERROR 4: `///' does not exist in the file system, and is not recognised as a supported dataset name. img2grd (GMTAPI_Import_Grid): Not a supported grid format [///] Error returned from GMT API: GMT_GRID_READ_ERROR (18) img2grd: Syntax error -R option. Correct syntax:

Awk not ouputting results via echo

2015-11-23 Thread Lester Anderson
Hello, Having sorted how to access a separate drive location, I have expanded the script to include an awk section which processes new coordinate limits which should pass to img2grd to extract the data grids. However, the awk scripting does not seem to generate any data - is there something I am m