I have a data file A.txt (field separator = \t) :
Well Well Type Well Name Dye Target
A1 Unknown HIGH-001 FAM ViroFAM
A1 Unknown HIGH-001 HEX ViroHEX
And a template file B.txt:
kit
Software Version = NOVA_v1
Date And Time of Export = 07/02/2020 13:44:11 UTC
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
,taq,205920777.1,A01,Unkn-01
,taq,neg5,A02,Unkn-09
,,,,,,,,,,
*reporting.
And I want to print replace the value after the =in the second line of B.txt with VIRO_v1, but only when the pattern ViroHEX is present in the 5th column of A.txt.
In order to do that I start something like :
awk -F'\t' '
FNR==NR{ a[NR]=$2; next }
$1=="Software Version"{ print $0,"VIRO_v1"; next }
1
' B.txt FS=" =" B.txt > result.txt
But I didn't figure it out the part with A.txt. Do you have an idea how to do that?