Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the `tr` command in Windows?

What is the Windows equivalent of the tr command in Linux?

For example, tr can replace all colons with a newline character. Can this be done in Windows?

$ echo $PATH | tr ':' '\n'
/usr/local/bin
/usr/bin
like image 823
HattrickNZ Avatar asked Mar 27 '15 01:03

HattrickNZ


People also ask

What is the command for tr?

The tr command is a Linux command-line utility that translates or deletes characters from standard input ( stdin ) and writes the result to standard output ( stdout ). Use tr to perform different text transformations, including case conversion, squeezing or deleting characters, and basic text replacement.

What is tr in script?

tr is short for “translate”. It is a member of the GNU coreutils package. Therefore, it's available in all Linux distros. The tr command reads a byte stream from standard input (stdin), translates or deletes characters, then writes the result to the standard output (stdout).

How do I use tr to delete?

Using tr Command to Delete Characters You can use the -d (--delete) option followed by the character, set of characters or an interpreted sequence.


1 Answers

As far as I've learned, there isn't a drop in replacement for tr, but this works simply and memorably for your use case:

echo $env:PATH.Replace(';',"`r`n")
like image 175
Joseph Langeway Avatar answered Oct 13 '22 14:10

Joseph Langeway