I obviously do not grok the use of OFS (Output Field Separator) and how to
specify its use in a print statement. Here's my complete script:
------------------------------------------------------------------------------
#! /usr/bin/awk -f
# add-non-detect.awk -- Add both an indicator digit (0 = quantified, 1 = <RL)
# and bounds to non-detected quantities.
# Fields: site, sampdate, param, quant; last char is \n.
BEGIN { FS = "|"; OFS = "|" }
# Detected quantity
$4 !~ /-.*/ { print $1 $2 $3 $4 "0" $4 $4 }
# Non-detected quantity
$4 ~ /-.*/ { print $1 $2 $3 $4 "1" "0" $4 }
-------------------------------------------------------------------------------
And here are three lines of data:
'D-1'|'2007-12-12'|'Ag'|0.000|
'D-1'|'2007-12-12'|'Al'|0.106|
'D-1'|'2007-12-12'|'CO3'|-1.000|
The output from the script is:
'D-1''2007-12-12''Ag'0.00000.0000.000
'D-1''2007-12-12''Al'0.10600.1060.106
'D-1''2007-12-12''CO3'-1.00010-1.000
Not only are the pipe symbols missing, but I see the logic needs
correcting, too. I'll work on that after I learn how to properly specify OFS
and the print statements.
Rich
_______________________________________________
PLUG mailing list
[email protected]
http://lists.pdxlinux.org/mailman/listinfo/plug