Merging Two Seperate Text Files Together...

General questions about using TextPad

Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard

Post Reply
User avatar
AYHJA
Posts: 4
Joined: Thu Nov 25, 2004 11:28 am
Location: In this bish right, right, right thurr...
Contact:

Merging Two Seperate Text Files Together...

Post by AYHJA »

I am very sorry if this has been posted before, but I did do a search and after looking through the first ten pages or so, I didn't find what I was looking for...

I am trying to merge two seperate text files together, essentially taking what is on the first line of one document, and adding it to what is on the first line of another document...For instance:

Text File A has the questions (one per line)
Question A
Question B
Question C

Text File B has the answers
= Answer A
= Answer B
= Answer C

How can I merge the two documents together, to create Text File C..?
Question A= Answer A
Question B= Answer B
Question C= Answer C

Thanks for your help...

AYHJA
AYHJA ImageInc.
User avatar
MudGuard
Posts: 1295
Joined: Sun Mar 02, 2003 10:15 pm
Location: Munich, Germany
Contact:

Post by MudGuard »

You could add
letter a to all line starts in question file (find ^ replace by a)
then insert numbers (Edit - Fill block) with leading numbers before the a's (so they are all the same length.

Now repeat with answer file and letter b.

Your files look now like

001a Question A
002a Question B
003a Question C

001b Answer A
002b Answer B
003b Answer C

Now, add all the content of answer file to question file.
Then use Tools - Sort to sort the file - the result should look like

001a Question A
001b Answer A
002a Question B
002b Answer B
003a Question C
003b Answer C

now remove the first columns (block mode select) and you have
Question A
Answer A
Question B
Answer B
Question C
Answer C

Now you have to remove every second line break.
There was a thread about this just today or yesterday, see there.
bveldkamp

Post by bveldkamp »

Open the answers file
uncheck "Configure -> Word Wrap",
check "Configure -> Block Select Mode"
Select All
Copy

Open the questions file
Goto end of first line
Type one or more spaces, so you're past the end of the longest question
Paste


HTH, Berend
User avatar
AYHJA
Posts: 4
Joined: Thu Nov 25, 2004 11:28 am
Location: In this bish right, right, right thurr...
Contact:

Thanks..!

Post by AYHJA »

I appreciate your help, I should be good on that...

One more question...And I promise I'm reading the help files before I ask questions...

I am trying to insert a return after a certain group of characters...

For example:

ImageTagEnding ImageTagBeginning

to

ImageTagEnding
ImageTagBeginning

I don't see a syntax code for a carriage return...Thanks in advance...

AYHJA
AYHJA ImageInc.
bveldkamp

Post by bveldkamp »

It's \n (make sure "Regular expression" is checked)
User avatar
AYHJA
Posts: 4
Joined: Thu Nov 25, 2004 11:28 am
Location: In this bish right, right, right thurr...
Contact:

Can't get it right...

Post by AYHJA »

I tried that, and in did something really weird w/the contents of the page, so I know I did something wrong...

I don't have word wrapping on, btw, and here's what I'm trying to do...I have several BBcode links together, that are seperated by a single space...I want to convert those spaces into returns...This is how it looks:

[/URL] [URL=

I want to put a return where that space is inbetween the two of them...Do I need to include more text before and after each point to make it work..?

AYHJA
AYHJA ImageInc.
bveldkamp

Post by bveldkamp »

You could replace all spaces with \n, but this will replace all spaces in the entire file, so that may not be what you want.
Instead you could do this:

Code: Select all

Search: \] \[  <== Note the space after ] 
Replace: ]\n[
HTH, Berend
charles
Posts: 20
Joined: Mon Dec 27, 2004 5:11 pm
Contact:

Merging 2 text files

Post by charles »

I had to do it in the past, the easiest -I found- was to read both files, second being the second dimension of an array you populated with the first file's lines.
You just create a file from the resulting array ...
Post Reply