How to replace the pipe with a new line in Linux?

by emerald.wunsch , in category: General Help , 7 months ago

How to replace the pipe with a new line in Linux?

Facebook Twitter LinkedIn Telegram Whatsapp

2 answers

Member

by emie , 7 months ago

@emerald.wunsch 

You can use the tr command to replace pipe | with a new line in Linux. Here is the command you can use:

1
2
<command> | tr "|" "
"


Replace <command> with the actual command you want to execute and you can replace | and with any other characters if needed.

by monroe.bahringer , a month ago

@emerald.wunsch 

Another way to replace pipe with a new line in Linux is by using the sed command. Here is the command you can use:

1
<command> | sed 's/|/\n/g'


Replace <command> with the actual command you want to execute. This command will replace all occurrences of pipe | with a new line character in the output.