I have a file (A.txt ; sep=",") :
kit
Software Version =
Date And Time of Export =
Experiment Name =
Instrument Software Version =
Instrument Type = CFX
Instrument Serial Number =
Run Start Date =
Run End Date =
Run Operator =
Batch Status = VALID
Method = Novaprime
Date And Time of Export,Batch ID,Sample Name,Well,Sample Type,Status,Interpretive Result,Action*,Curve analysis
,,205920777.1,A01,Unkn-01,,,
,,neg5,A02,Neg Ctrl-01,,,
,,pos6,A03,Pos Ctrl-01,,,
,,,,,,,,,,
*reporting.
And I want to print in the "Interpretive Result" column a result if the "Sample Type" column contain a pattern : "Patient" if "Unkn" ; "NC" if "Neg" ; "PC" if "Pos". In order to have the following output (B.txt ; sep=","):
kit
Software Version =
Date And Time of Export =
Experiment Name =
Instrument Software Version =
Instrument Type = CFX
Instrument Serial Number =
Run Start Date =
Run End Date =
Run Operator =
Batch Status = VALID
Method = Novaprime
Date And Time of Export,Batch ID,Sample Name,Well,Sample Type,Status,Interpretive Result,Action*,Curve analysis
,,205920777.1,A01,Unkn-01,,Patient,,
,,neg5,A02,Neg Ctrl-01,,NC,,
,,pos6,A03,Pos Ctrl-01,,PC,,
,,,,,,,,,,
*reporting.
I've try things like :
awk -F',' -v OFS="," '(NR>1 && $5="Unkn"*){print ...}' A.txt > B.txt
But I don't manage to solved the issue. Can someone have an idea?
Thanks
$5="Unkn"is an assignment, not a comparison$5=="Unkn"