Replace Pioneer Home   All Examples   Free Download

 New request --free  RSS: Replace Pioneer Examples

226.Text file splitter -- How to split files by columns with fixed widths, and save to files with sequence?

User: editor -- 2008-07-17
Hits: 231
Type: Text file splitter   
Search all Text file splitter examples
Description:
How to split files by columns with fixed widths, and save to files with sequence?
Input Sample:
File.txt:

Kap1Scl000921.0-275916 5.42
Eps Phe000924.7-454451 3.88
Psc001002.3+110844 5.51
And001019.3+460420 5.03
Output Sample:
File1.txt
Kap1
Eps

File2.txt
Scl
Phe
Psc
And

File3.txt
000921.0
000924.7
001002.3
001019.3

File4.txt
-275916
-454451
+110844
+460420

File5.txt
5.42
3.88
5.51
5.03
Answer:
Hint: You need to Download and install "Replace Pioneer" to finish following steps.
In this case, column widths of each column are: 4,3,8,7,-2,4
Note: -2 means skip by 2 characters.

Procedures:
1. ctrl-o open source text file
2. ctrl-h open 'Replace' dialog

* set "output file"(at right bottom) to filename with full path like d:\File.txt
* set ">" symbol to "<<< Split by column" to the left of output file.
* click 'settings' page:
set 'Split naming' to:


check option of '[v]Max word length' and enter the length value as:


3. click 'Replace', file will be splited to File1.txt, File2.txt, ...

Note: if "Max word length" is set, the columns will not be delimitered by default spaces, they are delimitered by fixed widths specified here.
Download Script:  scripts/226.rst.zip

Similar Examples:
How to split file by columns, and save each column as file a001.txt, a002.txt, ...? (55%)
How to split a file by every 100 lines, and put every 50 files into one folder? (54%)
How to batch split files into columns that separated by comma? (52%)
How to join hundreds of columns in different files into one csv file? (51%)
How to insert two columns into a database file separated by "|"? (51%)
How to batch rename files with the first word of file contents? (49%)
How to make subtraction on 2 columns of CSV file, and save it to TXT format? (49%)
How to replace the characters in fixed position in each line? (49%)

Check Demo of Text file splitter