I have a text file with entries like below
LondonTableABC
ROW1
Cell1
Row2
ParisTableBCD
ROW1
ROW2
NewYorkTableEFG
ROW1
ROW2
I want to insert a line break before the matching pattern "Table" in the file. Find and replace has been my friend for a task like this to insert a new line AFTER the matching pattern but I can't figure out how to insert it BEFORE the matching pattern.
The result I expect after the replacement is
LondonTableABC
ROW1
Cell1
Row2
ParisTableBCD
ROW1
ROW2
NewYorkTableEFG
ROW1
ROW2
Not sure to well understand your needs, but I guess you want:
^.+Table
\n$0
Explanation:
^ : begining of line
.+ : 1 or more any character
Table : literally Table
Replacement:
\n : line break (you could use \r\n if requested)
$0 : whole match (ie. Table)
Result for given example:
LondonTableABC
ROW1
Cell1
Row2
ParisTableBCD
ROW1
ROW2
NewYorkTableEFG
ROW1
ROW2
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With