A
ansher
Hello
What I am trying to achieve is to read a file and write the formatted
text into a new file. But I am facing some difficulty with that
Format: I am reading a file where line continuation is indicated by
“+” sign at the beginning of the new line. Remove the line
continuation and add (join) this new line to prev. one
NOTE: file do not have line number, it is only for your reference.
Line13: n01contacts/friends do you
Line14: +have in each of the services ;c=contacts(433)’1’
Output: n01 contacts/friends do you have in each of the
services ;c=contacts(433)’1’
Challenges: I cannot always consider “+”sign as the beginning of the
new line, those instances are
1.Section of lines should not be formatted after text ‘fld’, refer
line 16-23 should not be formatted. Lines after this section must be
formatted.
2. Section of lines should not be formatted after text ‘val’, refer
line 29-33 should not be formatted. Lines after this section must be
formatted.
3. Refer line 9-12, line 10 ends with ; but lines 11 & 12 do not.
After formatting line should be separated by single ;
*include q10.qin;txt=UNIQUENESS; bb=Top line; tx=Mid Value;tb=Low
Value
4.Refer line 13-14,
Line13: n01contacts/friends do you
Line14: +have in each of the services ;c=contacts(433)’1’
After formatting line should not be separated by single ; instead it
should read as
n01contacts/friends do you have in each of the services ;c=contacts
(433)’1’
Any solution to this will be of great help to me. Thanks
Format of original file:
Line1: n010-10 ;c=temp(433)'1'
Line2: n0111-25 ;c=temp(433)'2'
Line3: n0126-50 ;c=temp(433)'3'
Line4: n0151-100 ;c=temp(433)'4'
Line5: n01101-150 ;c=temp(433)'5'
Line6: net1151 CONTACTS OR MORE (NET)
Line7: n01151-200 ;c=temp(433)'6'
Line8: n01200+ ;c=temp(433)'7'
Line9: *include q10.qin;txt=UNIQUENESS
Line10: +bb=Top line;
Line11: +tx=Mid Value
Line12: +tb=Low Value
Line13: n01contacts/friends do you
Line14: +have in each of the services ;c=contacts(433)’1’
Line15: net1CONVENIENCE (NET)
Line16: fld c(m00),c(m96):3
Line17: +Easy to find/noticeable=044
Line18: +Quick=045
Line19: +Convenient=046
Line20: +Other convenience comments=050;%nosort
Line21: netend1
Line22: fld c(m00),c(m96):3
Line23: +NA=996;%nosort
Line24: *include lib\9pscale.qin;col(a)=697
Line25: +txt1=Value 1
Line26: +txt2=
Line27: +txt3=
Line28: +txt4=Value 4
Line29: val c(650,652);i
Line30: +1-25=1-25
Line31: +26-50=26-50
Line32: +51-75=51-75
Line33: +76-100=76-100
Line34: n01Clear testing/QA
Line35: +requirements ;c=c100'1'
Expected outputs after formatting:
n010-10 ;c=temp(433)'1'
n0111-25 ;c=temp(433)'2'
n0126-50 ;c=temp(433)'3'
n0151-100 ;c=temp(433)'4'
n01101-150 ;c=temp(433)'5'
net1151 CONTACTS OR MORE (NET)
n01151-200 ;c=temp(433)'6'
n01200+ ;c=temp(433)'7'
*include q10.qin;txt=UNIQUENESS;bb=Top line;tx=Mid Value;tb=Low Value
n01 contacts/friends do you have in each of the services ;c=contacts
(433)’1’
net1CONVENIENCE (NET)
fld c(m00),c(m96):3
+Easy to find/noticeable=044
+Quick=045
+Convenient=046
+Other convenience comments=050;
netend1
fld c(m00),c(m96):3
+NA=996;%nosort
*include lib\9pscale.qin;col(a)=697;txt1=Value
1;txt2=;txt3=;txt4=Value 4
val c(650,652);i
+1-25=1-25
+26-50=26-50
+51-75=51-75
+76-100=76-100
n01Clear testing/QA
requirements ;c=c100'1'
What I am trying to achieve is to read a file and write the formatted
text into a new file. But I am facing some difficulty with that
Format: I am reading a file where line continuation is indicated by
“+” sign at the beginning of the new line. Remove the line
continuation and add (join) this new line to prev. one
NOTE: file do not have line number, it is only for your reference.
Line13: n01contacts/friends do you
Line14: +have in each of the services ;c=contacts(433)’1’
Output: n01 contacts/friends do you have in each of the
services ;c=contacts(433)’1’
Challenges: I cannot always consider “+”sign as the beginning of the
new line, those instances are
1.Section of lines should not be formatted after text ‘fld’, refer
line 16-23 should not be formatted. Lines after this section must be
formatted.
2. Section of lines should not be formatted after text ‘val’, refer
line 29-33 should not be formatted. Lines after this section must be
formatted.
3. Refer line 9-12, line 10 ends with ; but lines 11 & 12 do not.
After formatting line should be separated by single ;
*include q10.qin;txt=UNIQUENESS; bb=Top line; tx=Mid Value;tb=Low
Value
4.Refer line 13-14,
Line13: n01contacts/friends do you
Line14: +have in each of the services ;c=contacts(433)’1’
After formatting line should not be separated by single ; instead it
should read as
n01contacts/friends do you have in each of the services ;c=contacts
(433)’1’
Any solution to this will be of great help to me. Thanks
Format of original file:
Line1: n010-10 ;c=temp(433)'1'
Line2: n0111-25 ;c=temp(433)'2'
Line3: n0126-50 ;c=temp(433)'3'
Line4: n0151-100 ;c=temp(433)'4'
Line5: n01101-150 ;c=temp(433)'5'
Line6: net1151 CONTACTS OR MORE (NET)
Line7: n01151-200 ;c=temp(433)'6'
Line8: n01200+ ;c=temp(433)'7'
Line9: *include q10.qin;txt=UNIQUENESS
Line10: +bb=Top line;
Line11: +tx=Mid Value
Line12: +tb=Low Value
Line13: n01contacts/friends do you
Line14: +have in each of the services ;c=contacts(433)’1’
Line15: net1CONVENIENCE (NET)
Line16: fld c(m00),c(m96):3
Line17: +Easy to find/noticeable=044
Line18: +Quick=045
Line19: +Convenient=046
Line20: +Other convenience comments=050;%nosort
Line21: netend1
Line22: fld c(m00),c(m96):3
Line23: +NA=996;%nosort
Line24: *include lib\9pscale.qin;col(a)=697
Line25: +txt1=Value 1
Line26: +txt2=
Line27: +txt3=
Line28: +txt4=Value 4
Line29: val c(650,652);i
Line30: +1-25=1-25
Line31: +26-50=26-50
Line32: +51-75=51-75
Line33: +76-100=76-100
Line34: n01Clear testing/QA
Line35: +requirements ;c=c100'1'
Expected outputs after formatting:
n010-10 ;c=temp(433)'1'
n0111-25 ;c=temp(433)'2'
n0126-50 ;c=temp(433)'3'
n0151-100 ;c=temp(433)'4'
n01101-150 ;c=temp(433)'5'
net1151 CONTACTS OR MORE (NET)
n01151-200 ;c=temp(433)'6'
n01200+ ;c=temp(433)'7'
*include q10.qin;txt=UNIQUENESS;bb=Top line;tx=Mid Value;tb=Low Value
n01 contacts/friends do you have in each of the services ;c=contacts
(433)’1’
net1CONVENIENCE (NET)
fld c(m00),c(m96):3
+Easy to find/noticeable=044
+Quick=045
+Convenient=046
+Other convenience comments=050;
netend1
fld c(m00),c(m96):3
+NA=996;%nosort
*include lib\9pscale.qin;col(a)=697;txt1=Value
1;txt2=;txt3=;txt4=Value 4
val c(650,652);i
+1-25=1-25
+26-50=26-50
+51-75=51-75
+76-100=76-100
n01Clear testing/QA
requirements ;c=c100'1'