TR(1plan9)
π TR(1plan9) β the translate-characters girlie π
okay so bestie, this is tr from the Plan 9 manual, section 1plan9. she takes your standard input, does a lil glow-up on the characters (runes, actually β we're fancy here), and hands you back standard output. it's giving character makeover montage. β¨
πΈ NAME πΈ
tr β translate characters π¦
π SYNOPSIS π
tr [ -cds ] [ string1 [ string2 ] ]
β¨ DESCRIPTION β¨
okay so here's the vibe: tr copies the standard input to the standard output, but with substitution or deletion of selected characters (runes, bestie, runes). any input character that shows up in string1 gets mapped into the matching character of string2. π
and when string2 is short? no worries, she pads it out to the length of string1 by duplicating its last character. iconic behavior honestly.
any combo of the options -cds is fair game:
-cβ Complement string1: swap it out for a lexicographically ordered list of all the other characters. not like other girls (literally).-dβ Delete from the input every character that's in string1. gone. blocked. deleted. π«-sβ Squeeze repeated output characters that occur in string2 down to single characters. one (1) copy, that's it, we don't do duplicates here. π«Ά
π the escape codes (iykyk) π
in either string, a noninitial sequence -x β where x is any character (possibly quoted) β stands for a range of characters: a possibly empty sequence of codes running from the successor of the previous code up through the code for x. periodt.
- the character
\followed by 1, 2 or 3 octal digits stands for the character whose 16-bit value is given by those digits. - the character sequence
\xfollowed by 1, 2, 3, or 4 hexadecimal digits stands for the character whose 16-bit value is given by those digits. - a
\followed by any other character just stands for that character. simple as. π
π₯ EXAMPLES π₯
replace all upper-case ASCII letters by lower-case
tr A-Z a-z <mixed >lower
downcase slay, no cap. πΈ
create a list of all the words in file2, one per line, where a word is taken to be a maximal string of alphabetics
string2 is given as a quoted newline here, bestie β watch the line break inside the quotes, it's load-bearing:
tr -cs A-Za-z '
' <file1 >file2
π SOURCE π
/src/cmd/tr.c
π¦ SEE ALSO π¦
π real talk though: everything above is exactly as the page says it. don't come for me if you use -c and get a whole lexicographically ordered list of everything else, because that is literally what it does. π
and that's the whole page, angel β TR(1plan9), Plan 9 manual, section 1plan9. mwah, go translate something cute πβ¨ππ«Ά
π¦ where this page comes from
- debian bookworm: 9base 1:6-13 Β· Lucent
- debian trixie: 9base 1:6-14 Β· Lucent
- ubuntu jammy: 9base 1:6-11 Β· Lucent
- ubuntu noble: 9base 1:6-14 Β· Lucent
- ubuntu questing: 9base 1:6-15
- ubuntu resolute: 9base 1:6-15build1 Β· Lucent
- ubuntu stonking: 9base 1:6-15build1 Β· Lucent
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms