[PLUG] awk syntax error, part ii

Larry Brigman larry.brigman at gmail.com
Fri May 25 21:07:10 UTC 2012


On Fri, May 25, 2012 at 1:43 PM, Rich Shepard <rshepard at appl-ecosys.com> wrote:
> 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
>
Well none of the other chemicals had a filter match with a value of 0.000.
The only match from the filter for chemical was Cr but it had a -0.006
Ba,Bi and Cd had 0.000 but nothing was in the filter for them.
I added two valued to the table to check that it work and they matched
and changed the values.



More information about the PLUG mailing list