Svoboda | Graniru | BBC Russia | Golosameriki | Facebook

To install click the Add extension button. That's it.

The source code for the WIKI 2 extension is being checked by specialists of the Mozilla Foundation, Google, and Apple. You could also do it yourself at any point in time.

4,5
Kelly Slayton
Congratulations on this excellent venture… what a great idea!
Alexander Grigorievskiy
I use WIKI 2 every day and almost forgot how the original Wikipedia looks like.
What we do. Every page goes through several hundred of perfecting techniques; in live mode. Quite the same Wikipedia. Just better.
.
Leo
Newton
Brights
Milds

From Wikipedia, the free encyclopedia

tr
Original author(s)Douglas McIlroy
(AT&T Bell Laboratories)
Developer(s)Various open-source and commercial developers
Initial releaseNovember 1973; 50 years ago (1973-11)
Repository
Written inC
Operating systemUnix, Unix-like, Plan 9, Inferno, OS-9, MSX-DOS, IBM i
PlatformCross-platform
TypeCommand
Licensecoreutils: GPLv3+
Plan 9: MIT License

tr is a command in Unix, Plan 9, Inferno, and Unix-like operating systems. It is an abbreviation of translate or transliterate, indicating its operation of replacing or removing specific characters in its input data set.

YouTube Encyclopedic

  • 1/3
    Views:
    9 107
    575
    1 115
  • 21 - Unix | Linux Shell - Translate | Delete - Character - STDIN | STDOUT - tr command - Hindi
  • Using Managed File Transfer local commands to remove UNIX line feeds in B2B
  • Solaris Kurulumu

Transcription

Overview

The utility reads a byte stream from its standard input and writes the result to the standard output. As arguments, it takes two sets of characters (generally of the same length), and replaces occurrences of the characters in the first set with the corresponding elements from the second set. For example,

tr 'abcd' 'jkmn'

maps all characters a to j, b to k, c to m, and d to n.

The character set may be abbreviated by using character ranges. The previous example could be written:

tr 'a-d' 'jkmn'

In POSIX-compliant versions of tr, the set represented by a character range depends on the locale's collating order, so it is safer to avoid character ranges in scripts that might be executed in a locale different from that in which they were written. Ranges can often be replaced with POSIX character sets such as [:alpha:].

The s flag causes tr to compress sequences of identical adjacent characters in its output to a single token. For example,

tr -s '\n'

replaces sequences of one or more newline characters with a single newline.

The d flag causes tr to delete all tokens of the specified set of characters from its input. In this case, only a single character set argument is used. The following command removes carriage return characters.

tr -d '\r'

The c flag indicates the complement of the first set of characters. The invocation

tr -cd '[:alnum:]'

therefore removes all non-alphanumeric characters.

Implementations

The original version of tr was written by Douglas McIlroy and was introduced in Version 4 Unix.[1]

The version of tr bundled in GNU coreutils was written by Jim Meyering.[2] The command is available as a separate package for Microsoft Windows as part of the UnxUtils collection of native Win32 ports of common GNU Unix-like utilities.[3] It is also available in the OS-9 shell.[4] A tr command is also part of ASCII's MSX-DOS2 Tools for MSX-DOS version 2.[5] The tr command has also been ported to the IBM i operating system.[6]

Most versions of tr, including GNU tr and classic Unix tr, operate on single-byte characters and are not Unicode compliant. An exception is the Heirloom Toolchest implementation, which provides basic Unicode support.

Ruby and Perl also have an internal tr operator, which operates analogously.[7][8] Tcl's string map command is more general in that it maps strings to strings while tr maps characters to characters.[9]

See also

References

  1. ^ McIlroy, M. D. (1987). A Research Unix reader: annotated excerpts from the Programmer's Manual, 1971–1986 (PDF) (Technical report). Computing Science. AT&T Bell Laboratories. 139.
  2. ^ "Tr(1): Translate/Delete char - Linux man page".
  3. ^ "Native Win32 ports of some GNU utilities". unxutils.sourceforge.net.
  4. ^ Paul S. Dayan (1992). The OS-9 Guru - 1 : The Facts. Galactic Industrial Limited. ISBN 0-9519228-0-7.
  5. ^ MSX-DOS2 Tools User's Manual by ASCII Corporation
  6. ^ IBM. "IBM System i Version 7.2 Programming Qshell" (PDF). IBM. Retrieved 2020-09-05.
  7. ^ "tr (String) - APIdock". APIdock. Retrieved 12 August 2015.
  8. ^ "tr - perldoc.perl.org". perldoc.perl.org. Retrieved 12 August 2015.
  9. ^ "Tcl Built-In Commands - string manual page". Retrieved 12 August 2015.

External links

This page was last edited on 25 July 2023, at 09:56
Basis of this page is in Wikipedia. Text is available under the CC BY-SA 3.0 Unported License. Non-text media are available under their specified licenses. Wikipedia® is a registered trademark of the Wikimedia Foundation, Inc. WIKI 2 is an independent company and has no affiliation with Wikimedia Foundation.