Rounding off real (floating point) values - bash to awk

2015-11-26 Thread Lester Anderson
Hello, I can use a script like: #!/bin/bash x=3.7 # pass variable x to awk via -v (var=value) awk -v x=$x 'BEGIN { printf "%3.0f\n", x }' # which returns the value 4 as expected, but are there any other methods that can be used? -- Problem reports: http://cygwin.com/problems.html FAQ:

Re: Awk not ouputting results via echo

2015-11-24 Thread Lester Anderson
all useful for someone who is just getting started with this scripting and Cygwin. Lester On 23 November 2015 at 20:39, Lee <ler...@gmail.com> wrote: > On 11/23/15, Lester Anderson <arctica1...@gmail.com> wrote: >> Hello, >> >> Having sorted how to access a sep

Data file access on different path (drive)

2015-11-23 Thread Lester Anderson
Hello, I am fairly new to using Cygwin, so hope that this query is not too simplistic. I have a bash script that integrates a lot of GMT commands and also calls a Fortran program to generate a map output. Now the problem is how to get the script/Cygwin to access two data files on a different

Re: Data file access on different path (drive)

2015-11-23 Thread Lester Anderson
3 November 2015 at 10:23, Peter Rosin <p...@lysator.liu.se> wrote: > > On 2015-11-23 10:51, Lester Anderson wrote: >> Hello, >> >> I tried a very basic script to test this: >> >> #!/bin/bash >> ruta_elev="cygdrive/q/geophys/Potential-field >> d

Re: Data file access on different path (drive)

2015-11-23 Thread Lester Anderson
"q:/geophys/Potential-field datasets/gravity/" $ pwd /cygdrive/q/geophys/Potential-field datasets/gravity At a loss as to how this works. Lester On 23 November 2015 at 08:57, Marco Atzeri <marco.atz...@gmail.com> wrote: > > > On 23/11/2015 09:54, Lester Anderson wrote: &g

Re: Data file access on different path (drive)

2015-11-23 Thread Lester Anderson
than one world image file name given. img2grd: Syntax error: More than one world image file name given. There are only one file to read in each directory as listed in the path so not sure why it is confused! On 23 November 2015 at 09:58, Marco Atzeri <marco.atz...@gmail.com> wrote: > &g

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

Re: Awk not ouputting results via echo

2015-11-23 Thread Lester Anderson
, Lester Anderson <arctica1...@gmail.com> 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

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

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;

Re: Awk not ouputting results via echo

2015-11-23 Thread Lester Anderson
those fiddly bits! Lester On 23 November 2015 at 16:24, Lester Anderson <arctica1...@gmail.com> wrote: > 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 >