Replace Pioneer Home   All Examples   Free Download

 New request --free  RSS: Replace Pioneer Examples

334.Text merge -- How to merge two text file base on the value of first column and do sort?

User: editor -- 2009-05-20          << 333  335 >>
Hits: 588
Type: Text merge   
Search all Text merge examples
Description:
I want to sort two data sets of fundamental stocks values, two spreadsheets of data, each with two columns of data imputed from two txt files. The data are not sequential and the sort desired produces a data txt output file for a third
spreadsheet, which aligns the data sets.
Input Sample:
SHEET 1 (imput as txt file)
A x
B x
C x
D x
E x
F x
G x

Sheet 2 (imput as txt file)
A x
B x
D x
F x
H x
J x
C x
Output Sample:
SHEET 3
A x A x
B x B x
C x C x
D x D x
E x .....
F x F x
G x ....
..... H x
..... .....
..... J x
Answer:
Hint: You need to Download and install "Replace Pioneer" on windows platform to finish following steps.
The solution is to merge the 2nd column of two files base on the value of 1st column, and do a sort operation at last.
Detailed procedures:

1. join the two txt files into one file, with one blank line between two files:
A    x
B    x
C    x
D    x
E    x
F    x
G    x
<here is one blank line>
A    x
B    x
D    x
F    x
H    x
J    x
C    x

2. ctrl-o open the text file prepared in step 1.
3. ctrl-h open 'replace' dialog
* set 'Replace Unit' to 'Line'
* set 'Replace Scope' to 'Paragraph'
** click "Advanced" page
* set "Run following at the beginning of replace" to:

* set "Run following for each matched unit" to:

* set "Insert End Text" to:

4. Click "Replace", done! 
Download Script:  scripts/334.rst.zip

Screenshot 1:  Replace_Window


Screenshot 2:  Replace_Advanced_Window


Similar Examples:
How to merge other columns' data base on the value of the first column? (70%)
How to merge the data of second column base on value of first column? (69%)
How to merge two or more csv files with different columns into one file? (60%)
How to merge adjacent lines having same value in column one in CSV files? (59%)
How to delete the 4th column from text files with 8 columns? (57%)
How to split a csv file according to the value of column A? (56%)
How to split a CSV file with Header according to value of a column? (55%)
How to batch rename text files by adding the value of file content to filename? (55%)

Check Demo of Text merge
Keywords:
sequential  align  third  merge two text file  1st  two files  2nd  text merge  merge  merg  one blank line between each line of text  merge each line of two files into one line  join two files for each line  merge base column  merge base  merge two line into one  join two text file  join two files