To achieve this, we start by
split(variables('Source'),outputs('New_Line'))outputs('Split_text_lines')?[0]contains(item(),'EMPTY')join(union(outputs('Store_Headers'),body('Filter_lines_that_contain_EMPTY')),outputs('New_Line')) We preserve headers so that final text files does not get ambiguous data.
P.S. power automate does not treat '\n' string well so we achieve this by defining a compose and placing a new line there as follows (hit enter in input section to achieve this)
Here's the full implementation