liunx of urandom to generate random characters

Author: Dengcong Cong

cat /dev/urandom | tr -dc a-zA-Z0-9#@_ | head -c16;echo

tr command can be used to replace characters from standard input, compression and deletion, tr can only receive an input stream from standard, can not receive parameters.

echo "aabbccffs" |tr "a" "@@"

Without parameters: replaces SET1 SET2 each character in each character, a character sequence Alternatively, if the character is greater than the length of SET1 SET2, then the extra characters in SET1 replaced with the last character SET2
-t: replaces SET1 SET2 each character in each character, a character sequence 1 to 1 character replacement, whether SET1 SET2 which is long, only replace the corresponding character, no extra replacement. 
-c: negate operation, the data taking the complement of SET1 stream specified character. 
-d: Delete the specified character SET1, there is no SET2 
-s: continuous repeated continuously SET1 specified character as a single character may be used instead -s '\ n' delete blank lines.

 

Guess you like

Origin www.cnblogs.com/dengcongcong/p/10938947.html