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

by emerald.wunsch , in category: General Help , a year ago

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

Facebook Twitter LinkedIn Telegram Whatsapp

2 answers

Member

by emie , a year 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 , 8 months 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.