Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
How to merge multiple text files in TSE 2.5 for DOS?
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  13 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Clueless in Seattle  
View profile  
 More options Aug 26 2012, 1:22 pm
From: Clueless in Seattle <spamless.in.seattle.re...@gmail.com>
Date: Sun, 26 Aug 2012 10:22:07 -0700 (PDT)
Local: Sun, Aug 26 2012 1:22 pm
Subject: How to merge multiple text files in TSE 2.5 for DOS?
Hi again!

I've got a box-full of old floppy disks containing hundreds of small
text files.  They range in size between about 8 and 25 KB.  (I think
that perhaps those files are so small because I got into the habit of
trying to keep files at about 15 K back when I was using WordStar in
my CP/M days).

I'd like to combine all of the files on each disk into a single file
that will fit onto a single floppy.

Hundreds of these files contain dated log entries so I'd like to be
able to keep the text of the files in chronological order within the
larger file.

The task of maintaining the chronology of the log entries should be
fairly simple, because all of the file names on each disk are
identical, except for the three character extension, like this:

   logfile.001
   logfile.002
   logfile.003
   logfile.etc...

Last night I started manually reading-in each file into a new file,
and it became so tedious that I quickly gave up the exercise.

I'm running TSE 2.5 for DOS.  I'm casting about for ideas for a macro
that could read those files, one-by-one, in chronological order, into
one large text file.  I think the trick would be to find a way for the
macro to keep count of the files as it works its way through them.

Any suggestions?


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Robert Seely  
View profile  
 More options Aug 26 2012, 1:35 pm
From: Robert Seely <r...@math.mcgill.ca>
Date: Sun, 26 Aug 2012 13:35:44 -0400 (EDT)
Local: Sun, Aug 26 2012 1:35 pm
Subject: Re: [TSE] How to merge multiple text files in TSE 2.5 for DOS?
Why not use the DOS command

  copy logfile.001+logfile.002+logfile.003+logfile.004 logfile.txt

(this is even easier with a better commandline, like 4DOS (as it used
to be) or TakeCommand).

You could create a simple batch file (using TSE!), as follows, if you
have LOTS of files to combine.  Do a directory listing

  dir logfile.* > combine.bat

(or whatever you want to call the batch file), then edit that file to
put all the filenames on a single line, with "+" between them, and the
"copy" command at the beginning, and the target file at the end.

I think if you add the switch "/n" , as in

  copy /n logfile.001+logfile.002+logfile.003+logfile.004 logfile.txt

then you can test this without actually changing anything or creating
a new file, just in case you want to try the syntax first.

Hope this helps.

-= rags =-

--
<r...@math.mcgill.ca>
<www.math.mcgill.ca/rags>

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Michael Boyd  
View profile  
 More options Aug 26 2012, 1:41 pm
From: "Michael Boyd" <michaelbo...@verizon.net>
Date: Sun, 26 Aug 2012 13:41:44 -0400
Local: Sun, Aug 26 2012 1:41 pm
Subject: Re: [TSE] How to merge multiple text files in TSE 2.5 for DOS?

Attached is a sample batch file that can copy multiple files into one. You
could also create a batch file using TSE to rename your files.

You can rename YYY.txt to yyy.bat and modify it to work. Let me know if you
need help. I'll work pro bono.

Michael Boyd

  YYY.TXT
11K Download

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Rick Bradley  
View profile  
 More options Aug 26 2012, 3:22 pm
From: "Rick Bradley" <r...@fjbradley.com>
Date: Sun, 26 Aug 2012 15:22:21 -0400
Local: Sun, Aug 26 2012 3:22 pm
Subject: Re: [TSE] How to merge multiple text files in TSE 2.5 for DOS?
It's been a long time but I think this will work in a batch file

From the command line in the diskette drive
dir logfile.* /b > c:\somedir\dirlist.txt

Edit the resulting file so that the first line reads
type a:\logfile.nnn > c:\somedir\bigfile
and subsequent lines read
type a:\logfile.nnn >> c:\somedir\bigfile
Save it as a batch file and run it
Skip the first line for subsequent diskettes

Fine tuning with the appropriate drives and directories would of course be
required.

On 26 Aug 2012 at 10:22, Clueless in Seattle wrote:

Regards
F.J. (Rick) Bradley
F.J. Bradley & Associates
http://www.fjbradley.com/
tel 519 354 4604
265 Oxley Dr. Chatham, ON, Canada N7L 4S8

Never ascribe to malice, that which can be explained by incompetence.
--Napoleon Bonaparte


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Larry  
View profile  
 More options Aug 26 2012, 4:07 pm
From: "Larry" <hayes_sm...@hotmail.com>
Date: Sun, 26 Aug 2012 15:07:47 -0500
Local: Sun, Aug 26 2012 4:07 pm
Subject: Re: [TSE] How to merge multiple text files in TSE 2.5 for DOS?
/***
Batch files are a good solution for DOS tasks, but some of them can be
done with macros. Haven't worked with TSE 2.5 in a while, but this macro
should work.

The following macro will create a blank NewFile() and will then
numerically insert the files on Disk Drive A: according to the filename
convention you mentioned in your message. That is to say, it will find
and insert the numerica file extensions of the files on drive a: from
lowest to highest, however many there are.

After the macro inserts each file, it also inserts a separator line of
asterisks and the actual filename of the file being inserted.

At the end, a message box tells you how many files were inserted from
the disk.

This may not be what you want, but you can adapt it however you wish.
For instance, you could add a prompt at the end to rename the NewFile
name.

***/

// jigmerge.s - merge files on disk to one file in tse

proc main()

string fn[_maxpath_]=""
integer i=0

newfile() // create file to put merged files

loop
  unmarkblock()
  i=i+1 // keep count
//  fn=*rev1"+format(str(i):3:"0")+".s" // test line

  // create the filenames as described in message
  fn="a:\*."+format(str(i):3:"0") // real line

  // see if the file exists on disk
  if fileexists(fn)
    // if it does, insert it
    endfile()
    begline()
    addline()
    addline(format("*":query(rightmargin):"*")) // merged text separator
    begline()
    addline(fn) // merged text filename
    addline()
    addline()
    pushkey(<enter>) // bypass pickfile window
    insertfile(fn)//,_dont_prompt_) // insert the file
  else
    goto ending
  endif
  if keypressed() goto ending endif
endloop

goto ending
ending:

sound(9000,90)
warn(str(i-1)+" Files Were Merged.") // total files merged

end


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Discussion subject changed to "How to merge multiple text files in TSE 2.5 for DOS?(((Second Better Macro)" by Larry
Larry  
View profile  
 More options Aug 27 2012, 12:13 pm
From: "Larry" <hayes_sm...@hotmail.com>
Date: Mon, 27 Aug 2012 11:13:45 -0500
Local: Mon, Aug 27 2012 12:13 pm
Subject: Re: [TSE] How to merge multiple text files in TSE 2.5 for DOS?(((Second Better Macro)
/***
Okay, the jigmerge.s will do as it says, but, unfortunately, there could
be a problem. :}

Say your disk has 25 files named logfile.001 to logfile.025 but
logfile.010 is missing. Jigmerge will stop at logfile.009.

This jigmerge2.s uses a different approach. This macro places a bare
directory of the disk in drive A: into a file, then loads the file and
processes each filename by inserting it into the merge file in the
sorted order they appear on the disk. This should result in a proper
merging of the files sequentially from lowest extension to highest
extension.

I also added the assigned key <ctrlshift x> to make executing the macro
a bit easier.

And, I also added an automatic filenaming routine. The filename will use
the name "lfdisk.###" with ### being the buffer number of the file. The
macro will also use your TSE home path in the filename. You can comment
it out if you like.

(NOTE: For the merge file naming, the expectation is that your will do
all of your merging during one TSE session. Otherwise, there could be a
naming conflict since the naming uses the buffer number of the mew
merged file as its extension.)

As before, the assumption is that you are getting files from a disk on
drive A: and that the file extensions are numeric from a low number like
.001 up to a possible high number of .999. Also, ALL of the files on any
single disk will be merged even if they do not have the numeric
extension...this can easily be changed to ONLY do numeric extensions,
but the assumption is that these are the only files on your disks to be
merged.

Execute the macro for each disk you place in drive A:.

***/

// jigmerge.s - merge files on disk to one file in tse

<ctrlshift x> execmacro("jigmerge2")

proc main()

string tmpfn[_maxpath_]=loaddir()+"logfile.tmp" // the a: directory list
string fn[_maxpath_]="" // each filename in tmpfn list

integer tb=0 // the target merge file buffer id
integer wb=0 // the tmpfn buffer id

integer count=0 // total files merged

tb=newfile() // create file to put merged files

// merge file naming routine
changecurrfilename(loaddir()+"lfdisk."+format(str(tb):3:"0"))

// my test directory line
//dos("dir "+loaddir()+"mymac\jigp*rev1*.s /b > "+tmpfn,_dont_prompt_) // my
test line

// get directory of disk A:
dos("dir a:\logfile.* /b > "+tmpfn,_dont_prompt_) // for disk A:
wb=editfile(tmpfn)
begfile()

// merge the disk a: files to one file in numeric order
repeat
  unmarkblock()
  fn=gettext(1,currlinelen())//loaddir()+"mymac\*rev1"+format(str(i):3:"0")+" .s"
// test line
  gotobufferid(tb)
  endfile()
  begline()
  addline()
  addline(format("*":query(rightmargin):"*")) // merged text separator
  begline()
  addline(fn) // merged text filename
  addline()
  addline()
  insertfile(fn,_dont_prompt_) // insert the file
  count=count+1
  if keypressed() goto ending endif
  gotobufferid(wb)
until not down()

goto ending
ending:

if wb
  abandonfile(wb)
endif
gotobufferid(tb)
begfile()
sound(9000,90)
updatedisplay()
warn(str(count)+" Files Were Merged. ") // total files merged
unmarkblock()

end


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Clueless in Seattle  
View profile  
 More options Aug 28 2012, 11:56 am
From: Clueless in Seattle <spamless.in.seattle.re...@gmail.com>
Date: Tue, 28 Aug 2012 08:56:25 -0700 (PDT)
Local: Tues, Aug 28 2012 11:56 am
Subject: Re: How to merge multiple text files in TSE 2.5 for DOS?(((Second Better Macro)
Hi again!

I had to take a few days off from this project.

The backlight in the hand-me-down laptop I've been using for web
access went dead on me a few days ago.  And I had a housing authority
inspection of my apartment that I had to get ready for, which just
plum tuckered me out.  Then a couple of days of running errands on my
bicycle (I can't a afford a car) that put me to bed for a few days
more.

But I've recovered somewhat and now I've got a humongous CRT monitor
on a wobbly TV cart rolled up next to my bed, and I've connected it to
that screen-dead laptop.  And with the aid of an old pair of bifocals
I'm able to just barely make out the screen, so it looks like I'm back
in business, albeit it rather awkwardly so.

I'm bowled over by all of time and effort you guys have put into
working out proposed solutions to my problem.  You can't know how much
it means to me to have you guys helping me out on this.

I'm especially impressed by all the work that Larry has put into that
macro.  Whew!

I'm having trouble reading the screen on this old monitor at this
distance, so I may have to break down and use up some toner and print
out your replies and study them the old fashioned way: on paper.

I have to confess that just looking at all the steps in that macro has
me feeling overwhelmed.  But I'm hoping that it will be a fun exercise
to try to pick it apart to figure out exactly how it works step-by-
step.

I'm afraid I won't be checking in here as often as I'd like to, until
I can scare up another laptop.  I do have an old PC with internet
access, but due to a disabling circulation disorder, I don't do very
well sitting up (my poor old heart can't get the blood up to my poor
old brain, so when I sit up I get even more confused than usual; and
anxious and panicky on top of that).

Do you think it would be inappropriate to post a message in this forum
asking if anyone has an old laptop that they no longer use?

Thanks again for all the help this project.  Thanks to you guys I've
found a new sense of purpose in my declining years,

Will in Seattle
a.k.a. "Clueless"


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Discussion subject changed to "How to merge multiple text files in TSE 2.5 for DOS?" by Clueless in Seattle
Clueless in Seattle  
View profile  
 More options Aug 30 2012, 4:31 pm
From: Clueless in Seattle <spamless.in.seattle.re...@gmail.com>
Date: Thu, 30 Aug 2012 13:31:11 -0700 (PDT)
Local: Thurs, Aug 30 2012 4:31 pm
Subject: Re: How to merge multiple text files in TSE 2.5 for DOS?

On Aug 26, 1:07 pm, "Larry" <hayes_sm...@hotmail.com> wrote:

> // jigmerge.s - merge files on disk to one file in tse

> proc main()

> string fn[_maxpath_]=""

Hi Larry,

I decided to try the shorter macro first, since it is not as complex,
and got as far as the first command.  I hunted through my manual and
couldn't find _maxpath_.  The index was no help, but by going through
the manual page by page I came across _maxlength_.  At least I think
that's what  it said.  I should have put a bookmark in the manual
because now I can't find it.  May I substitute _maxlength_ for
_maxpath_  in the macro?

Just for the heck of it I tried compiling it to see what would happen.

I got two errors:

Error 103 (5.11) Unknown key word '_maxpath_'

Error 185 (40,11) ')' expected

I looked at that line and counted the parentheses, and there seem to
be just two pair.  So I can't see where that extra parenthesis mark is
supposed to go.

Time for my nap!

Will in Seattle
a.k.a. "Clueless


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Larry  
View profile  
 More options Aug 30 2012, 9:20 pm
From: "Larry" <hayes_sm...@hotmail.com>
Date: Thu, 30 Aug 2012 20:20:28 -0500
Local: Thurs, Aug 30 2012 9:20 pm
Subject: Re: [TSE] Re: How to merge multiple text files in TSE 2.5 for DOS?

Okay, just change _maxpath_ to the number 255

The _maxpath_ error may be responsible for the missing parenthesis error,
but more likely, one of the source lines became wrapped when you copied it
to be compiled. From curiosity, what is your window width? I may have to
send that macro by attachment if your screen width is to small.

As I mentioned in the second macro, the first one will work if all the
numeric extensions  have no missing numbers. If you have logfile.001 to
logfile.025, and logfile.010 is missing, the macro will stop at logfile.009.
The second macto, jigmerg2.s, should fix that problem.

Didn't you used to write macros? Hopefully, it will all come back to you...


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Discussion subject changed to "Open error: WAS: How to merge multiple text files in TSE 2.5 for DOS?" by Spamless in Seattle
Spamless in Seattle  
View profile  
 More options Aug 31 2012, 10:42 am
From: Spamless in Seattle <spamless.in.seat...@gmail.com>
Date: Fri, 31 Aug 2012 07:42:11 -0700
Local: Fri, Aug 31 2012 10:42 am
Subject: Open error: WAS: How to merge multiple text files in TSE 2.5 for DOS?
On 8/30/2012 6:20 PM, Larry wrote:

> Okay, just change _maxpath_ to the number 255

OK; just did that.  And also deleted the line that gave the parenthesis
error (it turned out to be the line that gave the beep upon completion).

And then it ran perfectly!  Thanks a million for figuring out how to do
this, Larry.

I've now got a 1400k file open in TSE containing the text of all 91
files from my original floppy.  And it only took a few seconds to create
the file.  That's amazing!

But, when I tried to save that file to my RAM drive E:

I got this error message:  "Open error: [unnamed-1]  Press <Escape>"

I looked in the index of my TSE User's Guide trying to find out what
that error means.  But there is no index entry for "error codes"

Do you know what that error message means?  And what I need to do to
correct the problem?

> Didn't you used to write macros? Hopefully, it will all come back to you...

Hard to believe, isn't it?  Sad but true though.

About a decade or so ago I switched from VDE to TSE (after trying out a
number of other text editors along the way) and TSE became my editor of
choice.

I did write a few macros for it back then.  Most of them just called
sequences of complex DOS batch files that I had written during the
previous decade.

By the time I started using TSE I was already suffering from troubling
cognitive deficits from chronic illness that were exacerbated by
frequent temporal lobe seizures that left huge holes in my memory. My
disabling physical symptoms worsened to the point that I lost my job and
housing and was homeless for a while, so I had to toss out a lot of
stuff but was able to put my computer disks into storage.

Once I got back into stable housing and started receiving helpful
treatment for my illness I tried to get TSE up and running again, but
the hand-me-down laptop I was running it on died, so the project lay
dormant for a number of years.

It's only in the last few months that I've made a concerted effort to
resurrect my old TSE note-taking system, by making it a habit to work on
this project for an hour each day, first thing in the morning, the time
of day when I have the most energy and am better able to concentrate.

So, most of what I had learned about TSE in the short time that I had
used it back around the turn of the century has been been pretty much
erased by the passage of the years, the repeated seizures, and my
worsening cognitive deficits.

Thanks for the encouragement, Larry!  It *is* coming back to me, albeit
very slowly, and in small pieces.

Will in Seattle
a.k.a. "Clueless"


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Larry  
View profile  
 More options Aug 31 2012, 12:48 pm
From: "Larry" <hayes_sm...@hotmail.com>
Date: Fri, 31 Aug 2012 11:47:57 -0500
Local: Fri, Aug 31 2012 12:47 pm
Subject: Re: [TSE] Open error: WAS: How to merge multiple text files in TSE 2.5 for DOS?

Sure. You have to rename the file to a legitimate filename. I had thought to
put in an automatic renaming routine, but decided that I could not read your
mind and know what you wanted the names to be, so I left it out.

The second macro does automatically rename the new merged file, but you can
easily change that name, too.

Hopefully, you will be able to re-learn some macro language...there's
nothing more stimulating that structuring a problem in your mind and then
finding the macro stuff to accomplish it.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Clueless in Seattle  
View profile  
 More options Aug 31 2012, 1:16 pm
From: Clueless in Seattle <spamless.in.seattle.re...@gmail.com>
Date: Fri, 31 Aug 2012 10:16:07 -0700 (PDT)
Local: Fri, Aug 31 2012 1:16 pm
Subject: Re: Open error: WAS: How to merge multiple text files in TSE 2.5 for DOS?

On Aug 31, 9:48 am, "Larry" <hayes_sm...@hotmail.com> wrote:

> Sure. You have to rename the file to a legitimate filename.

Thanks, Larry!

In between my earlier post and reading your most recent post I fiddled
around a bit and figured out that I have to name the file *before*
trying to save it.  My error was that I was expecting a prompt asking
me for a file name *after* I entered the "Save File" command.

So I've now got one set of 91 small files merged into a single large
file, (thanks to your patience and diligence).

> Hopefully, you will be able to re-learn some macro language...there's
> nothing more stimulating that structuring a problem in your mind and then
> finding the macro stuff to accomplish it.

I know what you mean!

Years ago I decided to write a little GW-BASIC flashcard style program
to help me learn Spanish vocabulary.  It started out with about 8 or
10 lines of code.

But I kept thinking of enhancements that I could add, and soon it had
ballooned to pages and pages and pages of code and sub-routines and
sub-sub-routines and was taking up all my time.  I no longer used it
for practicing Spanish.  It had become an end in itself.  I could not
stop working on it.

Fortunately for me, the laptop I was using to work on it died, and I
dropped the project before it ate me alive.

Thanks again for sticking with me and seeing me through to the
completion of this macro.  It means a great deal to me.

Will in Seattle
a.k.a. "Clueless"


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Larry  
View profile  
 More options Aug 31 2012, 8:05 pm
From: "Larry" <hayes_sm...@hotmail.com>
Date: Fri, 31 Aug 2012 19:05:34 -0500
Local: Fri, Aug 31 2012 8:05 pm
Subject: Re: [TSE] Re: Open error: WAS: How to merge multiple text files in TSE 2.5 for DOS?

By the way, I just remembered that TSE 2.5 does not support long filenames.
So, if you decide to use the second macro, jigmerge2.s, change its name to
one with 8 characters in the filename.

Also, if you want to use the assigned key, change the line in the source:

<ctrlshift x> execmacro("jigmerge2")

to your new macro name, such as:

<ctrlshift x> execmacro("merge2")

It's been a long time since I used it. :) Too bad you can't get a new
computer and upgrade to TSEPRO 4.4, which is what I use.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »