Replace Pioneer Home   All Examples   Free Download

 New request --free  RSS: Replace Pioneer Examples

912.Advanced search and replace -- How to delete the last 3 words only if the first line has 8 words or more?

User: elinathurman -- 2012-02-04          << 911  913 >>
Hits: 1501
Type: Advanced search and replace   
Search all Advanced search and replace examples
Description:
If the title more than 8 words, then delete the last 3 words
Input Sample:
first_line:aa bb cc dd ee ff gg hh

body: blah! blah! blah! blah!
Output Sample:
first_line:aa bb cc dd ee

body: blah! blah! blah! blah!
Answer:
Hint: You need to Download and install "Replace Pioneer" on windows platform to finish following steps.
Following steps will remove the last 3 words in first line, only if the first line has 8 words or more:

1. open "Tools->Batch Runner" menu
2. drag multiple files from "windows file browser" to "Batch Runner" window
3. click "Fast Replace" button to open "Fast Replace" window
4. click "Add" to add rules:
* set "search" to:

* set "replace" to:

* click "ok"
5. make sure "Reg exp" options and "cross line" options are checked.
6. click "start", and click "ok", done!

Note: please make backup in advanced to avoid mis-operation.

Screenshot 1:  Fast_Replace_Window


Similar Examples:
How to insert a keyword only at first line of multiple text files? (54%)
How to replace words in a text file only if they are whole words? (53%)
How to replace the words with its nearest different words in the same column?
(51%)
How to replace strings with words in a list in sequence or randomly? (51%)
How to delete a list of files from a directory and subdirectories? (51%)
How to add words at the begin and end of first line in multiple files? (50%)
How to delete the first 1-10 lines in many files?  (50%)
How to extract all lines that contain specified words or phrases? (49%)

Check Demo of Advanced search and replace
Keywords:
iso  more than  scalar  backup  rules  or more  title  cross line  the last  operation  delete last line in multiple files windows  remove last line in multiple files  add words last  delete title  delete first words  remove first line from multiple files windows  remove first line from multiple  search only in first line in multiple files