-
Processing Text File
Hi Folks,
I have a huge text file that I want to convert to .html and upload to my site. Included in the file are hundreds of entries separated by a blank line. Wherever those blank lines exist, I want to insert . There MUST be a way to do this other than by brute force.
Suggestions?
A.
-
most text editors have a find->replace feature.
-
I had to do something very similar recently and this is the way I did it. http://uk.answers.yahoo.com/question...9072105AAjHDWu
Shock! Horror! MS Word for web-work? Surely not! Well, normally no, but in my circumstances it worked fine.
However, I have since discovered a better/safer way to do it in Notepad++ (freebie, plain text editor that you can get from http://notepad-plus-plus.org/ ) and that method is described here http://stackoverflow.com/questions/1...r-with-notepad
Hope that helps
-
Traq,
Did try that approach. The problem with "find" on the software I tried is the software treats what I want to be a hard return argument as a tab, and processes it, essentially, as a find null. But it would make little sense to tell the software to replace null with something else. The software I looked at was notepad, wordpad, and word perfect.
Bev,
Thanks, I'll take a look.
A.
-
gedit is a free, cross-platform text editor (similar to notepad) that can do it.
-
Just curious, but what do you mean by brute force marain?
Could str_replace or preg_replace be used here, especially if it is only one file?
-
Suppose you have a text file like this one:
Copy the whole text file to the clipboard, then put the result in a converter like this one.
A click on the convert button will show you the result on the right. In this case, the result will be aaa\n\nbbb\n\nccc\n\nddd.
Replace the old content of the text file with that string.
Change the text file into a html file.
Open the html file using notepad, then replace each occurrence of \n with <br>
Safe the file. That's all.
-
OK. Used Word, per suggestion of Beverley, mission accomplished! I had no idea of Word's ability in that regard.
James438, by "brute force," I meant pasting in the desired code wherever the double line break occurred. Word informed me that it made 1700+ such replacements.
Thank you, all.
A.
-
I'm glad you got this resolved. I would encourage you to mark this as resolved as well by editing the first post and then click "go advanced" where you will then see the option to do so.
Thank you for explaining brute force. I tend to think of brute force as a way to hack passwords. I didn't think that was what you meant here, but was curious if it was the name of another similar type of program.
-
I've oft' wondered how to mark an issue "resolved." Thank you for the method!
A.