Forráskód Böngészése

tr: improve page

- Add source data to all examples
- Add an example for piping from another command
- Improve punctuation in main description
- Add token markup {{}} to one example that was missing it
- Remove redundant "and print result" from the last two examples
  (it's true for all the ones shown)
Waldir Pimenta 6 éve
szülő
commit
2ac2881390
1 módosított fájl, 11 hozzáadás és 7 törlés
  1. 11 7
      pages/common/tr.md

+ 11 - 7
pages/common/tr.md

@@ -1,27 +1,31 @@
 # tr
 
-> Translate characters - run replacements based on single characters and character sets.
+> Translate characters: run replacements based on single characters and character sets.
 
 - Replace all occurrences of a character in a file, and print the result:
 
-`tr {{find_characters}} {{replace_characters}} < {{filename}}`
+`tr {{find_character}} {{replace_character}} < {{filename}}`
+
+- Replace all occurrences of a character from another command's output:
+
+`echo {{text}} | tr {{find_character}} {{replace_character}}`
 
 - Map each character of the first set to the corresponding character of the second set:
 
-`tr 'abcd' 'jkmn' < {{filename}}`
+`tr '{{abcd}}' '{{jkmn}}' < {{filename}}`
 
 - Delete all occurrences of the specified set of characters from the input:
 
-`tr -d '{{input_characters}}'`
+`tr -d '{{input_characters}}' < {{filename}}`
 
 - Compress a series of identical characters to a single character:
 
-`tr -s '{{input_characters}}'`
+`tr -s '{{input_characters}}' < {{filename}}`
 
-- Translate the contents of the file to upper-case and print result:
+- Translate the contents of a file to upper-case:
 
 `tr "[:lower:]" "[:upper:]" < {{filename}}`
 
-- Strip out non-printable characters from the file and print result:
+- Strip out non-printable characters from a file:
 
 `tr -cd "[:print:]" < {{filename}}`