hi all:
I have just registred to start a new thread regarding use of awk to parse text file and I' m new in awk language
I took a portion of data from texte file :
I have parsed the text file with this code . test file is texte file example.
I want to get bellow data :
I cant figured out how to do that any help will be appreciated .
thanks
I have just registred to start a new thread regarding use of awk to parse text file and I' m new in awk language
I took a portion of data from texte file :
Code:
DATA
DATA
GHR1
BRAND
TRUE
LST
115-34-SPECT
115-42-SPECT
115-50-SPECT
BRAND
FALSE
LIST
115-34-SPECT
115-42-SPECT
115-50-SPECT
END
I have parsed the text file with this code . test file is texte file example.
Code:
awk -v '/^DATA/&& /BRAND/ {if(NR>1) print "DATAFIRST=" getline }' test
I want to get bellow data :
Code:
DATAFIRST=GHR1,LSIT=115-34-SPECT,BLOC,BRAND=TRUE;
DATAFIRST=GHR1,LSIT=115-42-SPECT,BLOC,BRAND=TRUE;
DATAFIRST=GHR1,LSIT=115-50-SPECT,BLOC,BRAND=TRUE;
DATAFIRST=GHR1,LSIT=115-34-SPECT,DEBLOC,BRAND=FALSE;
DATAFIRST=GHR1,LSIT=115-42-SPECT,DEBLOC,BRAND=FALSE;
DATAFIRST=GHR1,LSIT=115-50-SPECT,DEBLOC,BRAND=FALSE;
I cant figured out how to do that any help will be appreciated .
thanks