[PLUG] awk syntax error, part ii

Rich Shepard rshepard at appl-ecosys.com
Fri May 25 20:43:28 UTC 2012


On Fri, 25 May 2012, Larry Brigman wrote:

> Now that I had some sample code there are a couple of other things here.
> The resulting output file won't have the trailing | character.
> Your filters will also output blank lines with | characters.

Larry,

   The output from this script could have the final '|' or I add that in
emacs before running the output through a different awk script that codes
each row depending on whether the last value is negative.

> Here is the resulting file output from your sample data using the
> corrected filter:
> --------------------------------
> 'A'|'1987-12-12'|'Ag'|-0.005
> 'A'|'1987-12-12'|'Al'|0.106
> 'A'|'1987-12-12'|'CO3'|-1.000
> 'A'|'1987-12-12'|'HCO3'|231.000
> 'A'|'1987-12-12'|'Alk_tot'|231.000
> 'A'|'1987-12-12'|'As'|0.011
> 'A'|'1987-12-12'|'Ba'|0.000
> 'A'|'1987-12-12'|'Be'|-0.002
> 'A'|'1987-12-12'|'Bi'|0.000
> 'A'|'1987-12-12'|'Ca'|100.000
> 'A'|'1987-12-12'|'Cd'|0.000
> 'A'|'1987-12-12'|'Cl'|1.430
> 'A'|'1987-12-12'|'Co'|0.000
> 'A'|'1987-12-12'|'Cr'|-0.006
> 'A'|'1987-12-12'|'Cu'|0.024
> -------------------------------------
> Only the first line had data changed from 0.000 to -0.005.

   Now why is that? There must be a logic flaw in the script. _Every_ 'Ag'
was changed, but none of the other chemicals showing 0.000.

Rich




More information about the PLUG mailing list