Merging lines with continuation character and doing replacem
Posted: Mon Jan 31, 2005 5:32 pm
1) How can I merge lines that have an &, then find if 2 words exists to then replace 3 words?
Original string:
SUBFILE EMF147.PUB &
KEEP &
SIZE 50000 &
INCL SUBWHSE, DATE-ISSUE &
INDEX SUBWHSE
find SUBFILE AND SIZE
Continuation character is &.
then take out SIZE and Next word (Value of 50000 for this case).
note: the word SUBFILE can be SUB, or SUBF or SUBFI ...
also the words can be anywhere in the sentence except SUBFILE.
SUBFILE EMF147.PUB &
SIZE 50000 &
KEEP &
INCL SUBWHSE, DATE-ISSUE &
INDEX SUBWHSE
or
SUBFILE EMF147.PUB &
KEEP &
INCL SUBWHSE, DATE-ISSUE &
SIZE 50000 &
INDEX SUBWHSE
...
final result:
SUBFILE EMF147.PUB &
KEEP &
&
INCL SUBWHSE, DATE-ISSUE &
INDEX SUBWHSE
2) How can I find the word SUBFILE in the same scenario as above, but this time add the word KEEP if it isn't there in the sentence?
Original string:
SUBFILE EMF147.PUB &
KEEP &
SIZE 50000 &
INCL SUBWHSE, DATE-ISSUE &
INDEX SUBWHSE
result: do nothing.
Original:
SUBFILE EMF147.PUB &
SIZE 50000 &
INCL SUBWHSE, DATE-ISSUE &
INDEX SUBWHSE
result:
SUBFILE EMF147.PUB KEEP &
SIZE 50000 &
INCL SUBWHSE, DATE-ISSUE &
INDEX SUBWHSE
Thanks for the last answer, it worked well.
And hope you can do this, it would same me a lot of time.
Regards,
Charles
Original string:
SUBFILE EMF147.PUB &
KEEP &
SIZE 50000 &
INCL SUBWHSE, DATE-ISSUE &
INDEX SUBWHSE
find SUBFILE AND SIZE
Continuation character is &.
then take out SIZE and Next word (Value of 50000 for this case).
note: the word SUBFILE can be SUB, or SUBF or SUBFI ...
also the words can be anywhere in the sentence except SUBFILE.
SUBFILE EMF147.PUB &
SIZE 50000 &
KEEP &
INCL SUBWHSE, DATE-ISSUE &
INDEX SUBWHSE
or
SUBFILE EMF147.PUB &
KEEP &
INCL SUBWHSE, DATE-ISSUE &
SIZE 50000 &
INDEX SUBWHSE
...
final result:
SUBFILE EMF147.PUB &
KEEP &
&
INCL SUBWHSE, DATE-ISSUE &
INDEX SUBWHSE
2) How can I find the word SUBFILE in the same scenario as above, but this time add the word KEEP if it isn't there in the sentence?
Original string:
SUBFILE EMF147.PUB &
KEEP &
SIZE 50000 &
INCL SUBWHSE, DATE-ISSUE &
INDEX SUBWHSE
result: do nothing.
Original:
SUBFILE EMF147.PUB &
SIZE 50000 &
INCL SUBWHSE, DATE-ISSUE &
INDEX SUBWHSE
result:
SUBFILE EMF147.PUB KEEP &
SIZE 50000 &
INCL SUBWHSE, DATE-ISSUE &
INDEX SUBWHSE
Thanks for the last answer, it worked well.
And hope you can do this, it would same me a lot of time.
Regards,
Charles