Tr (Unix)
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. OverviewThe 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 The tr -s '\n' replaces sequences of one or more newline characters with a single newline. The tr -d '\r' The tr -cd '[:alnum:]' therefore removes all non-alphanumeric characters. ImplementationsThe original version of The version of Most versions of 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 alsoReferences
External linksThe Wikibook Guide to Unix has a page on the topic of: Commands
|
Portal di Ensiklopedia Dunia