Replace Pioneer Home   All Examples   Free Download

 New request --free  RSS: Replace Pioneer Examples

1197.Advanced search and replace -- How to take part of the first line and insert them in text file randomly?

User: michal -- 2014-04-29          << 1196  1198 >>
Hits: 3481
Type: Advanced search and replace   
Search all Advanced search and replace examples
Description:
I have 250 .txt articles. Each article looks like in sample text. 
I want to take and insert first line of each article excluding: "2014" or sometimes "2013" and [title] tags - randomly between first 3-5 words. 
 
Also randomly insert only "word1 word2 word3" together 2 times. 
 
Keep in mind that "basewords" are sometimes 2 or sometimes 4 words long.
Input Sample:
[title]basewords word1 word2 word3 2014[/title] 
[img]doesnt matter[img] 
content content content content content content content content 
(around 500 words each file)
Output Sample:
[title]basewords word1 word2 word3 2014[/title] 
[img]doesnt matter[img] 
conten content content[b]basewords word1 word2 word3[b] content content content 
[...] 
content word1 word2 word3 content content content 
[...] 
content content word1 word2 word3 content content content content
Answer:
Hint: You need to Download and install "Replace Pioneer" on windows platform to finish following steps.
1. ctrl-h open 'replace' dialogue 
* set 'replace with pattern' to: 
 
* click 'advanced' tab, set 'run following for each matched unit' to: 
 
2. click 'batch' button open "Batch Runner" dialogue 
3. drag multiple files to "Batch Runner" window 
4. click "Batch Replace", done. 
 
Please make backup in advance, to avoid operation error. 
 

Screenshot 1:  Replace_Window


Screenshot 2:  Replace_Advanced_Window


Similar Examples:
How to take words from first line and insert into text file randomly? (87%)
How to sort all the lines of a text file randomly? (68%)
How to extract half of lines from a text file randomly? (67%)
How to extract 3 lines from each file randomly? (63%)
How to batch rename files with the first line of file content as new file name? (59%)
How to insert a keyword only at first line of multiple text files? (58%)
How to delete the first word in each line in a text file? (57%)
How to batch insert part of the filename into the file content? (56%)

Check Demo of Advanced search and replace
Keywords:
error  insert first line  together  tags  backup  randomly  times  tag  keep  random  insert only first line in text file  replace text between tags batch  insert words in multiple text files  count matched words text file  randomly replace words  insert title  lines tags  insert randomly