My primary software app exports polygons to ascii files in the proprietor’s own format that their rep says they don’t have a filter for, and acknowledges that it’s a problem. The data are pairs of X-Y coordinates. The (abbreviated) format is displayed in a sample file below. As opposed to the common columnar format for many ascii data files, this software outputs paired values linearly for so many samples, then does a hard return and a line feed and repeats. In the dummy sample it goes linearly for three samples; IRL it’s five. The value on the first line indicates how many samples there are.
None of my other software can deal with this format.
I’m not a programmer, and I’m sure there’s an answer to this in that arena; the only tools I bring to the fight are Word (or Wordpad) and Excel.
In Word, I can search for the two spaces between sample pairs, and manually replace them with a carriage return. Fine for something like the sample, but impractical for a data file with thousands of lines of samples. What I thought might work there would be if I could figure out how to enter a hard return (perhaps through an escape sequence?) as the Replace with value when it finds a double space. So far, I haven’t made that work.
With Excel, I’ve been able to get it to generate a column of values (A2, C2, E2, A3, C3, E3, etc.) with a drag, but it needs, (in this example it’s done in column D) the =INDIRECT($D$7) function to do it, and that will not, at my level of understanding, pick up the series repitition.
So, with Word or Excel, how would I best convert the above file format to a sequential two column ascii file?
It sounds like a Word Macro would do what you want. Here’s a tutorial. Basically, you can just do the find-replace thing, set it to a macro, and then automate it.
I have done a similar search and replace in word, around 10,000 lines, and it worked fine. I don’t think a macro is required, cos it’s so easy to do with search and replace…
Search and Replace in Word should do it. You can replace the double space with a RETURN pretty easily.
Failing that, round up a computer geek and pay them for two hours work to write a conversion program. Just make sure you find one who really understands what you want (as opposed to trying to do what they find interesting).
As others have said S&R in word does this for you. On my copy of word it’s Edit/Replace then under the More button is bunch of stuff including a Special button which allows you to find or insert various things, including paragraph marks and manual line feeds one of which will end up with the format you need.
A macro would work just as well. If you’re going to run into this sort of issue a lot you might want to look at getting some sort of text-manipulation software and learning the basics.
Unbelievable. Your primary software vendor doesn’t have the software development to convert this? Hmmm…
Do you have a Java Runtime on your machine? To find out, just go out to a command prompt and type java. If you have it (and your path is pointing to it), you should get back a bunch of options you can use. If you do, and you are willing, this would take me just a few minutes to spit something out. Trivial, really.
If you’re willing, type “java -version” so I can code to the right version of java you have, and let me know.