다음과 같은 파일이 있습니다 A.txt
(필드 구분 기호 = ,
).
Kit Batch Export
Software Version = NO_v1
Date And Time of Export =
Experiment Name = MY20195334_MOL_2014_20201006Run180017
Instrument Software Version =
Instrument Type = Cji
Instrument Serial Number =
Run Start Date =
Run End Date =
Run Operator =
Batch Status = VALID
Method = Nov
Date And Time of Export,Batch ID,Sample Name,Well,Sample Type,Status,Interpretive Result,Action*,Curve analysis,EC,CH
,MY20195334_MOL_2014_20201006Run180017,2061571293,A01,Unkn-01,VALID,,,
,MY20195334_MOL_2014_20201006Run180017,2061584371,A02,Unkn-09,VALID,,,
*See Kit IFU for reporting activities.
CE-IVD
For In Vitro Diagnostic Use.
다음과 같이 _
첫 번째 열 뒤와 세 번째 열 앞의 내용만 유지하여 두 번째 열을 구문 분석 하고 싶습니다 ._
Kit Batch Export
Software Version = NO_v1
Date And Time of Export =
Experiment Name = MY20195334_MOL_2014_20201006Run180017
Instrument Software Version =
Instrument Type = Cji
Instrument Serial Number =
Run Start Date =
Run End Date =
Run Operator =
Batch Status = VALID
Method = Nov
Date And Time of Export,Batch ID,Sample Name,Well,Sample Type,Status,Interpretive Result,Action*,Curve analysis,EC,CH
,MOL_2014,2061571293,A01,Unkn-01,VALID,,,
,MOL_2014,2061584371,A02,Unkn-09,VALID,,,
*See Kit IFU for reporting activities.
CE-IVD
For In Vitro Diagnostic Use.
이를 위해 다음과 같이 시도합니다.
awk 'BEGIN{FS=OFS=","} NR==4{split($1,a,"_")} NR>13{$2=a[2]"_"a[3]} 1' A.txt > B.txt
작동하지만 다음과 같이 파일 끝에서 인쇄가 계속됩니다.
Kit Batch Export
Software Version = NO_v1
Date And Time of Export =
Experiment Name = MY20195334_MOL_2014_20201006Run180017
Instrument Software Version =
Instrument Type = Cji
Instrument Serial Number =
Run Start Date =
Run End Date =
Run Operator =
Batch Status = VALID
Method = Nov
Date And Time of Export,Batch ID,Sample Name,Well,Sample Type,Status,Interpretive Result,Action*,Curve analysis,EC,CH
,MOL_2014,2061571293,A01,Unkn-01,VALID,,,
,MOL_2014,2061584371,A02,Unkn-09,VALID,,,
,MOL_2014
*See Kit IFU for reporting activities.,MOL_2014
CE-IVD,MOL_2014
For In Vitro Diagnostic Use.,MOL_2014
이 문제를 해결하는 방법을 아는 사람이 있나요? 감사해요