Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

How do you echo lines with special characters to file?

Jul
2
0
I grab a line from a text file to a variable and output it to another. Example: DO line IN @file1.txt echo %line >> file2.txt ENDDO It has a problem: special characters like " ` < > | and long lines (is there a variable length limit?) are not appended to the file but are printed on screen. How do make it do the job properly (like it does when the lines aren't too long and don't contain special characters)? As a workaround, I'm replacing all occurrences of special characters, like " with ---doublequote---, and then replacing them back to original when the echoing is done. If this is the only way, how would I do that for all special characters in a whole file? Got code? Now I'm doing it manually in text editor, and perhaps will record a macro for it. How do I remove the appended lines from the original file?
 
textparser wrote:
| I grab a line from a text file to a variable and output it to
| another. Example: DO line IN @file1.txt echo %line >> file2.txt
| ENDDO It has a problem: special characters like " ` < > | and long
| lines (is there a variable length limit?) are not appended to the
| file but are printed on screen. How do make it do the job properly
| (like it does when the lines aren't too long and don't contain
| special characters)? As a workaround, I'm replacing all occurrences
| of special characters, like " with ---doublequote---, and then
| replacing them back to original when the echoing is done. If this
| is the only way, how would I do that for all special characters in a
| whole file? Got code? Now I'm doing it manually in text editor, and
| perhaps will record a macro for it.

That's what the new feature in V10: binary buffers were invented for. Look
at the functions @B...!
--
HTH, Steve
 
I'm unfamiliar with those. How would you do the equivalent of what I did, with @B...? How do you delete the lines from the original after appending them to a new file?
 
I grab a line from a text file to a variable and output it to another. Example: DO line IN @file1.txt echo %line >> file2.txt ENDDO It has a problem: special characters like " ` < > | and long lines (is there a variable length limit?) are not appended to the file but are printed on screen. How do make it do the job properly (like it does when the lines aren't too long and don't contain special characters)?

see http://mindprod.com/products.html#SAY!
includes MASM and C versions if you want to compose a short string containing control chars and special chars and redirect it to a file.
 
I grab a line from a text file to a variable and output it to another. Example: DO line IN @file1.txt echo %line >> file2.txt ENDDO It has a problem: special characters like " ` < > | and long lines (is there a variable length limit?) are not appended to the file but are printed on screen. How do make it do the job properly (like it does when the lines aren't too long and don't contain special characters)? As a workaround, I'm replacing all occurrences of special characters, like " with ---doublequote---, and then replacing them back to original when the echoing is done. If this is the only way, how would I do that for all special characters in a whole file? Got code? Now I'm doing it manually in text editor, and perhaps will record a macro for it. How do I remove the appended lines from the original file?

You might also be interested in this:

http://www.unm.edu/~cdye/plugins/safechars.html
 
Back
Top
[FOX] Ultimate Translator
Translate