J
JimEagleOne
I'm trying to unravel the mysteries of the ^p "character" and trying using
search and replace.
I have numerous ASCII text files. They unfortunately have solitary CR
characters (Hex 0D) buried in the text, often in series, as well as the
standard CR/LF. So, I thought I would use word to delete them. It's turned
out to be a bigger task than I thought.
These Hex 0D characters are shown in Word two ways using the Courier New font:
1. In the middle of a line, it appears as a box.
2. At the end of a line, it disappears next to the end of line marker even
when the show formatting marks is turned on, so you can never really see
them. A hex dump shows the characters to be Hex 0D0D0A.
I have huge files I have to process, so I've made myself a macro to try to
delete these evasive little characters. But it's been rather difficult.
But here's one process I created that sort of works. It's a three pass
routine:
1. Replace all LFs with a character string of "~~~%". This method exposes
all the solitary CRs and Word internally coverts their display to paragraph
marks.
2. Next step is to delete all the solitary CRs.
3. Finally, revert the true end-of-line markers "~~~%" back to "^p" and we
are done.
After that, the appearance of the text is correct and all the solitary CRs
are gone. But there's a catch. All the CRs are now solitary CRs in the code
and are no longer CR/LF even though it displays correctly. And I don't see a
way to convert them back using a macro. I've tried replacing ^p with ^13^10,
but that just adds an extra box character. Maybe it doesn't matter after the
text file is saved.
I'm stumped. I'm stumped. Is there a better way?
search and replace.
I have numerous ASCII text files. They unfortunately have solitary CR
characters (Hex 0D) buried in the text, often in series, as well as the
standard CR/LF. So, I thought I would use word to delete them. It's turned
out to be a bigger task than I thought.
These Hex 0D characters are shown in Word two ways using the Courier New font:
1. In the middle of a line, it appears as a box.
2. At the end of a line, it disappears next to the end of line marker even
when the show formatting marks is turned on, so you can never really see
them. A hex dump shows the characters to be Hex 0D0D0A.
I have huge files I have to process, so I've made myself a macro to try to
delete these evasive little characters. But it's been rather difficult.
But here's one process I created that sort of works. It's a three pass
routine:
1. Replace all LFs with a character string of "~~~%". This method exposes
all the solitary CRs and Word internally coverts their display to paragraph
marks.
2. Next step is to delete all the solitary CRs.
3. Finally, revert the true end-of-line markers "~~~%" back to "^p" and we
are done.
After that, the appearance of the text is correct and all the solitary CRs
are gone. But there's a catch. All the CRs are now solitary CRs in the code
and are no longer CR/LF even though it displays correctly. And I don't see a
way to convert them back using a macro. I've tried replacing ^p with ^13^10,
but that just adds an extra box character. Maybe it doesn't matter after the
text file is saved.
I'm stumped. I'm stumped. Is there a better way?