For faster navigation, this Iframe is preloading the Wikiwand page for tr (Unix).

tr (Unix)

Tr

Description de l'image Tr Unix.png.
Informations
Dépôt openbsd.su/src/usr.bin/trVoir et modifier les données sur Wikidata
Type Utilitaire UNIX (d)Voir et modifier les données sur Wikidata

tr (translate) est une commande Unix qui permet de transposer ou d'éliminer des caractères dans un fichier ou un flux de données.

Exemples :

  • Pour remplacer a par j, b par k, c par m et d par n.
tr 'abcd' 'jkmn' < fichier

Ce qui peut aussi s'écrire

tr 'a-d' 'jkmn' < fichier
  • Pour remplacer les minuscules par les majuscules correspondantes
tr 'a-z' 'A-Z' < fichier
  • Pour remplacer n blancs continus par un seul
tr -s ' ' < fichier
  • Pour remplacer le caractère ':' par un saut de ligne
tr ':' '\013' < fichier


tr servait avec la commande dd pour permettre sur un même type de cassette DC6150 un échange entre le VMS et l'Unix.

Commandes analogues

[modifier | modifier le code]

La commande expand d'Unix/Linux permet de convertir les tabulations en espaces (par défaut, une tabulation est transformée en huit espaces).

La commande unexpand remplace les espaces en début de ligne par une tabulation.

Voir également

[modifier | modifier le code]


{{bottomLinkPreText}} {{bottomLinkText}}
tr (Unix)
Listen to this article

This browser is not supported by Wikiwand :(
Wikiwand requires a browser with modern capabilities in order to provide you with the best reading experience.
Please download and use one of the following browsers:

This article was just edited, click to reload
This article has been deleted on Wikipedia (Why?)

Back to homepage

Please click Add in the dialog above
Please click Allow in the top-left corner,
then click Install Now in the dialog
Please click Open in the download dialog,
then click Install
Please click the "Downloads" icon in the Safari toolbar, open the first download in the list,
then click Install
{{::$root.activation.text}}

Install Wikiwand

Install on Chrome Install on Firefox
Don't forget to rate us

Tell your friends about Wikiwand!

Gmail Facebook Twitter Link

Enjoying Wikiwand?

Tell your friends and spread the love:
Share on Gmail Share on Facebook Share on Twitter Share on Buffer

Our magic isn't perfect

You can help our automatic cover photo selection by reporting an unsuitable photo.

This photo is visually disturbing This photo is not a good choice

Thank you for helping!


Your input will affect cover photo selection, along with input from other users.

X

Get ready for Wikiwand 2.0 🎉! the new version arrives on September 1st! Don't want to wait?