jeudi 5 mars 2015

How does "-dc" work in "cat /dev/urandom | tr -dc "01"?


So far I know, the /dev/urandom file is one of the special files, it's purpose is to generate random characters. When I execute cat /dev/urandom a stream of strange characters, some even Chinese ideograms are displayed continuously. However, if I pipe this stream of strange characters into tr with the option -dc it makes a random stream of 0 and 1 or whatever characters are put into quotation marks in tr -dc "setofcharacters".


I tried to read the manual for tr, but under -d and -c I get explanations that I do not understand or could make sense of, like




-c, -C, --complement
use the complement of SET1

-d, --delete
delete characters in SET1, do not translate


could someone please be so kind and deliver a step by step explanation of the logic behind cat /dev/urandom | tr -dc "01"



Aucun commentaire:

Enregistrer un commentaire