Re: [BLACKBOX] How to concatenate ASCII files

From: [at]} <Bob>
Date: Thu, 26 Jul 2012 22:23:34 +0100

----boundary-LibPST-iamunique-1081763209_-_-
Content-type: text/plain

Do you mean merge, or do you mean concatenate, or is it the task of reading
ASCII files that is important?

Rene has probably given you the best approach to reading ASCII files.

Concatenate typically means adding one to the end of the other, whereas
merge means interleaving the contents in some way (which might
coincidentally result in concatentation!) but they are different problems.

Concatenating them is easy and shouldn't require Blackbox - you could do it
with Windows command line.

The ease or difficulty of merging them depends on their structure and on the
merging rules, so it's not really possible to give a simple answer. Back in
my COBOL programming days it was a common requirement to merge files,
typically a file of transactions with a master file to produce a new master
file.

The Jackson Structured Programming method describes a way of handling
merging problems (among others) based on describing the structure of each
input file and output as, effectively, a regular expression. It then
provides rules for matching elements and for resolving difficulties. These
result in a program structure which is easy to code and produces very
efficient results. It is very similar to the recursive descent approach to
writing compilers, and the structure charts / regular expressions are
equivalent to ebnf for describing the syntax of languages.

So, after writing all that, I think I'm saying it might be easier to help if
we knew the structure of your input texts, how to match the different
elements, and what is the desired structure of the output file.

B



> -----Original Message-----
> From: BlackBox [mailto:BLACKBOX{([at]})nowhere.xy
> Neubauer
> Sent: 26 July 2012 17:03
> To: BLACKBOX{([at]})nowhere.xy
> Subject: [BLACKBOX] How to concatenate ASCII files
>
> Hi all,
> in the near future I will have to programatically merge two or three
> ASCII files into one new file.
> Does anybody have a hint how to do this in a simple manner ?
> I had a look at the interface of module WinApi but could not find a
> procedure for this task.
> Reading the files line by line into a buffer and writing the contents
> to a new file seems to be a bit nasty.
>
> Best regards,
> Rainer
>
> ----
> To unsubscribe, send a message with body "SIGNOFF BLACKBOX" to
> LISTSERV{([at]})nowhere.xy


----
To unsubscribe, send a message with body "SIGNOFF BLACKBOX" to LISTSERV{([at]})nowhere.xy----boundary-LibPST-iamunique-1081763209_-_-
Content-type: application/rtf
Content-transfer-encoding: base64
Content-Disposition: attachment; filename="rtf-body.rtf"
e1xydGYxXGFuc2lcYW5zaWN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HRocmVlXHBhcg0KPiBBU0NJSSBmaWxlcyBpbnRvIG9u
ZSBuZXcgZmlsZS5ccGFyDQo+IERvZXMgYW55Ym9keSBoYXZlIGEgaGludCBob3cgdG8gZG8gdGhp
cyBpbiBhIHNpbXBsZSBtYW5uZXIgP1xwYXINCj4gSSBoYWQgYSBsb29rIGF0IHRoZSBpbnRlcmZh
Y2Ugb2YgbW9kdWxlIFdpbkFwaSBidXQgY291bGQgbm90IGZpbmQgYVxwYXINCj4gcHJvY2VkdXJl
IGZvciB0aGlzIHRhc2suXHBhcg0KPiBSZWFkaW5nIHRoZSBmaWxlcyBsaW5lIGJ5IGxpbmUgaW50
byBhIGJ1ZmZlciBhbmQgd3JpdGluZyB0aGUgY29udGVudHNccGFyDQo+IHRvIGEgbmV3IGZpbGUg
c2VlbXMgdG8gYmUgYSBiaXQgbmFzdHkuXHBhcg0KPiBccGFyDQo+IEJlc3QgcmVnYXJkcyxccGFy
DQo+IFJhaW5lclxwYXINCj4gXHBhcg0KPiAtLS0tXHBhcg0KPiBUbyB1bnN1YnNjcmliZSwgc2Vu
ZCBhIG1lc3NhZ2Ugd2l0aCBib2R5ICJTSUdOT0ZGIEJMQUNLQk9YIiB0b1xwYXINCj4gTElTVFNF
UlZATElTVFMuT0JFUk9OLkNIXHBhcg0KXHBhcg0KXHBhcg0KLS0tLVxwYXINClRvIHVuc3Vic2Ny
aWJlLCBzZW5kIGEgbWVzc2FnZSB3aXRoIGJvZHkgIlNJR05PRkYgQkxBQ0tCT1giIHRvIExJU1RT
RVJWQExJU1RTLk99fQAvQ049VFJFVVRXRUk=
----boundary-LibPST-iamunique-1081763209_-_---
Received on Thu Jul 26 2012 - 23:23:34 UTC

This archive was generated by hypermail 2.3.0 : Thu Sep 26 2013 - 06:30:00 UTC