Sysop.Fr
Catégories

apache

awk

bash

charmap

date

echo

encoding

find

grep

hexdump

irc

iso3166

ls

mysql

od

openssh

printf

python

read

sed

seq

smpp

sort/uniq

tar

tr

ucp

Articles

Mémo de la commande tr

La commande tr permet de convertir ou éliminer des caractères.

-délimine les caractères

1. Exemples

root@ubuntu:~# cat -ve bash_crlf.txt
line1^M$
line2

root@ubuntu:~# od -c bash_crlf.txt
0000000   l   i   n   e   1  \r  \n   l   i   n   e   2
0000014


root@ubuntu:~# tr -d '\r' <bash_crlf.txt >bash_lf.txt

root@ubuntu:~# cat -ve bash_lf.txt
line1$
line2

root@ubuntu:~# od -c bash_lf.txt
0000000   l   i   n   e   1  \n   l   i   n   e   2
0000013