I have a text file with following data and each row ends with |END|. T|somthing|something|END|T|something2|something2|END|I am tryig to replace |END| with \n new line with sed.  sed 's/\|END\|/\n/g' test.txtBut it's producing wrong output like below: T | s o m e ...But what I want is this:T|somthing|somethingT|something2|something2I also tried with tr. It didn't work either.
How to replace a word with new line
text processing;sed;regular expression;newlines
Use this:sed 's/|END|/\n/g' test.txtWhat you attempted doesn't work because sed uses basic regular expressions, and your sed implementation has a \| operator meaning or (a common extension to BRE), so what you wrote replaces (empty string or END or empty string) by a newline.