Thanks, Mike! This is a great start - exactly what I needed. I have a question for you though: how did you make decisions whether a line should be read from the template and copied to output, or read from the variables/arrays?
Thanks very much,
~ Eric.
I have a pretty big (306 line) xml file that represents information (metadata) about geological data collected by a government agency. The data in this xml is ugly, and hard to parse. However, there are really only about 20 different fields in this file that change from one geological survey to...
Ok.
I need to append a column of data onto the end of another file:
File 2:
192121412
192121413
192121417
192121444
...
File 1:
46,42,,,192,09:22:13,Gravelly sand/cobbles,
46,42,,,192,09:22:17,Gravelly sand/cobbles,
46,42,,,192,09:22:44,Gravelly sand/cobbles,
...
to become...
I need to append a column of data onto the end of another file:
File 2:
192121412
192121413
192121417
192121444
192121445
192121502
192121516
...
File 1:
1,192121412,651215.162,5171375.56
2,192121413,651215.291,5171375.619
3,192121417,651215.804,5171375.855...
I should also mention that the input file is just one long string of comma-separated numbers, dozens of values long; I placed 5 values on one line in the above example so that they would fit on the screen.
~ Eric.
Suppose that the number of comma-delimited records in the input file is variable (usually in the hundreds). How would your script work in a general case such as this?
Thanks for your feedback!
~ Eric.
Thanks! That works fine. I guess I could have avoided creating a csv file with a trailing comma in the first place if I knew of a way to convert a file like this
192123623
192123628
192123635
192123637
192123637
...
into a comma-delimited file with no comma after the last record.
I have a comma-separated values text file, consisting of just numbers and commas:
192123623,192123628,192123635,192123637,192123637,
192123642,192123652,192123652,192123655,192123704,
192123714,192123714,192123722,192123728,192123628,
192123749,192123824,
I want to remove the comma from the...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.