Search and Replace entire line

Tool for Search and Replace across multiple files.
Post Reply
somebody2978
Posts: 2
Joined: Wed Sep 01, 2021 8:06 pm

Search and Replace entire line

Post by somebody2978 »

Hi,

I'm editing a text file and trying to make TextCrawler search a certain phrase or word, delete the entire line and be replaced by a different line.

Example,

The bus was carrying a lot of people.
The bus is stuck and cannot move forward.
The bus will be delayed.

TextCrawler would have to find only the word "bus" and replace all those lines with that word by "The car is parked" in each line, resulting in something like this:

The car is parked.
The car is parked.
The car is parked.


Can I do this with this program?
User avatar
DigitalVolcano
Site Admin
Posts: 1717
Joined: Thu Jun 09, 2011 10:04 am

Re: Search and Replace entire line

Post by DigitalVolcano »

It would be something like this
-Regular Expression mode
- Dot matches newline OFF
- Multiline Anchors ON

RegEx

Code: Select all

^.*bus.*$
Replace:

Code: Select all

the car is parked
somebody2978
Posts: 2
Joined: Wed Sep 01, 2021 8:06 pm

Re: Search and Replace entire line

Post by somebody2978 »

DigitalVolcano wrote: Thu Sep 02, 2021 10:20 am It would be something like this
-Regular Expression mode
- Dot matches newline OFF
- Multiline Anchors ON

RegEx

Code: Select all

^.*bus.*$
Replace:

Code: Select all

the car is parked
It does not work, it leaves residues of the previous text, have to clean the entire line before inserting the new text.
Post Reply