Replace Pioneer Home   All Examples   Free Download

 New request --free  RSS: Replace Pioneer Examples

1191.Advanced search and replace -- How to make search and replace only in specified lines in text file?

User: colin -- 2014-04-03          << 1190  1192 >>
Hits: 2977
Type: Advanced search and replace   
Search all Advanced search and replace examples
Description:
How to make search and replace only in specified lines in text file? 
I have a text file, what i want to do is check each line, if line contains "ear" then if there is also the string ",i,ur," or ",i,r," then change that string to  ",ear," 
Input Sample:
clearstories,k,l,i,ur,s,t,oe,r,ee,z,,,,,,,,,,,,,,,,,,, 
clearwater,k,l,i,r,w,aw,t,ur,,,,,,,,,,,,,,,,,,,, 
Output Sample:
clearstories,k,l,ear,s,t,oe,r,ee,z,,,,,,,,,,,,,,,,,, 
clearwater,k,l,ear,w,aw,t,ur,,,,,,,,,,,,,,,,,,,, 
Answer:
Hint: You need to Download and install "Replace Pioneer" on windows platform to finish following steps.
1. ctrl-o open text file 
2. ctrl-h open 'replace' dialogue 
* set 'replace unit' to 'Line' 
* set 'search for pattern' to: 
 
* set 'replace with pattern' to: 
 
3. click 'replace', done. 
 
Hint: this operation is to filer out all lines contain ear, and use function "replace" to do search&replace.

Screenshot 1:  Replace_Window


Similar Examples:
How to search and replace words in specified column in csv file? (76%)
How to batch extract specified lines from a text file? (74%)
How to search and replace text 'ReplaceMe' only in specified lines? (71%)
How to search and replace text for specified occurrences with reg exp? (68%)
How do I replace specified lines with each line from a file? (67%)
How to search and sum the numbers at specified position in a text file? (67%)
How to change columns in each line to specified order in text file? (66%)
How to extract all specified links from a html file? (65%)

Check Demo of Advanced search and replace
Keywords:
what  contains  function  lines contain  specified line  operation  string  specified  line contain  contain  lines function  what is a search and replace  what is replace  if match contains  if contains  replace lines that contain  match contains  if then