Hi,
you can use ReplaceText by setting the Evaluation Mode property to "Line-by-Line", then set the "Line-by-Line Evalaution Mode" to "Last Line". In the Replacement Value set it to Empty String Set and the Search Value leave as "(?s)(^.*$)" as seen in the screenshot below:
If you find this helpful please accept solution. Thanks