mirror of https://github.com/CrimsonTome/tldr.git
add more examples to tr
These examples were suggested to add and are based from the tr-wikipedia article at https://en.wikipedia.org/w/index.php?title=Tr_(Unix)&oldid=631477596waldyrious/alt-syntax
parent
c86216e261
commit
70017a6200
|
@ -1,15 +1,27 @@
|
||||||
# tr
|
# tr
|
||||||
|
|
||||||
> translate characters - run replacements based on single characters
|
> translate characters - run replacements based on single characters and character sets
|
||||||
|
|
||||||
- replace all occurrences of a character in a file, and print the result
|
- Replace all occurrences of a character in a file, and prints the result
|
||||||
|
|
||||||
`tr {{find_character}} {{replace_character}} < {{filename}}`
|
`tr {{find_characters}} {{replace_characters}} < {{filename}}`
|
||||||
|
|
||||||
Translate the contents of the file to upper-case, prints result.
|
- Maps each character of the first set to the corresponding character of the second set.
|
||||||
|
|
||||||
|
`tr 'abcd' 'jkmn' < {{filename}}`
|
||||||
|
|
||||||
|
- Delete all occurances of the specified set of characters from the input.
|
||||||
|
|
||||||
|
`tr -d '{{input_characters}}'`
|
||||||
|
|
||||||
|
- Compresses a series of identical characters to a single character.
|
||||||
|
|
||||||
|
`tr -s '\n'`
|
||||||
|
|
||||||
|
- Translate the contents of the file to upper-case, prints result.
|
||||||
|
|
||||||
`tr "[:lower:]" "[:upper:]" < {{filename}}`
|
`tr "[:lower:]" "[:upper:]" < {{filename}}`
|
||||||
|
|
||||||
Strip out non-printable characters from the file, prints result.
|
- Strip out non-printable characters from the file, prints result.
|
||||||
|
|
||||||
`tr -cd "[:print:]" < {{filename}}`
|
`tr -cd "[:print:]" < {{filename}}`
|
||||||
|
|
Loading…
Reference in New Issue