Replace Pioneer Home   All Examples   Free Download

 New request --free  RSS: Replace Pioneer Examples

1390.Text file splitter -- How to split a text file with specified start and end line and name?

User: Adrian Holm -- 2017-02-18          << 1389  1391 >>
Hits: 970
Type: Text file splitter   
Search all Text file splitter examples
Description:
Hello,
I have a large text like the example one where I have a lot of programs that I want to extract them to new text documents. Each program starts with % (example) and ends with M02 (or can be when a new % lines comes). another thing is that I would like that the new document created to be named after the first line of the program (%12 for example).

I really hope you understood my request and you are able to help me.

Best regards Adrian
Input Sample:
%12
N10 (4X6 INDUSTRI BAGKASSE)
N8935 M72 (DOR OBNER)
N8940 (X)E60000=0 (Y)E61000=0 (Z)E62000=0 (A)E66000=0 (B)E67000=0 (NP-1)
N8950 (X)E60001=0 (Y)E61001=0 (Z)E62001=0 (A)E66001=0 (B)E67001=0 (NPV1)
N8960 E50001=0 (WZ-LENGDE D1) E52001=0 (WZ-RADIUS D1)
N8970 E50002=0 (WZ-LENGDE D2) E52002=0 (WZ-RADIUS D2)
N8990 G52 G X1000 Y0 Z-10 A0 B0
N8999 M107 (AFBLASNING FRA)
M02 (PROGRAM SLUT)
%155((PANORAMA 850)
N10 (850 MM PANORAMA SPEJL)
N15 (FREMSTILLINGS DATO 22-10-02)
N20 (SIDSTE PROGRAMENDRING 2
Output Sample:
%12
N10 (4X6 INDUSTRI BAGKASSE)
N8935 M72 (DOR OBNER)
N8940 (X)E60000=0 (Y)E61000=0 (Z)E62000=0 (A)E66000=0 (B)E67000=0 (NP-1)
N8950 (X)E60001=0 (Y)E61001=0 (Z)E62001=0 (A)E66001=0 (B)E67001=0 (NPV1)
N8960 E50001=0 (WZ-LENGDE D1) E52001=0 (WZ-RADIUS D1)
N8970 E50002=0 (WZ-LENGDE D2) E52002=0 (WZ-RADIUS D2)
N8990 G52 G X1000 Y0 Z-10 A0 B0
N8999 M107 (AFBLASNING FRA)
M02 (PROGRAM SLUT)
Answer:
Hint: You need to Download and install "Replace Pioneer" on windows platform to finish following steps.
1. ctrl-o open text file
2. open "File->Save As->Split to Files - split by Paragraph" menu
(1) set "Split naming" to: 
Note: if you want to keep only %155 as filename, you can enter:

(2) set "Para start" to: 
(3) set "Para end" to: 
3. click "Next", and select an output folder and base filename, done.
4. you can find the splitted files in the specified folder.

Similar Examples:
How to split a large text file into specified various number of lines? (70%)
How to extract text between specified start and end strings? (67%)
How to split a text file by line and rename each file to the line contents? (65%)
How to split a text file according to first word in each line? (65%)
How to batch replace files with specified format in each line? (64%)
How to count the number of specified part in each line? (63%)
How to split a text file to different files according to first word in each line? (63%)
How to split a text file into multiple files and take the date as filename? (63%)

Check Demo of Text file splitter
Keywords:
regard  best  firstline  large text  split by paragraph  split naming  document  naming  doc  help  split after words  txt file keep first words  lines starts  name files after first line  filename first line of document  name after first line  keep after  text document splitter