顯示具有 tr 標籤的文章。 顯示所有文章
顯示具有 tr 標籤的文章。 顯示所有文章

2022/06/22

/dev/urandom 取得隨几數


随机转换为md5(20位):

head /dev/urandom | md5sum | head -c 20

随机纯数字(20位):

head /dev/urandom | tr -dc 0-9 | head -c 20

随机小写字母+数字(20位):

head /dev/urandom | tr -dc a-z0-9 | head -c 20

随机大小写字母+数字(20位):

head /dev/urandom | tr -dc A-Za-z0-9 | head -c 20

https://piaohua.github.io/post/linux/20200825-linux-dev-urandom/

2016/02/20

昨天發現有几台brocade的fan壞了
本來在crontab是有寫檢查fail及error的script
但因為brocade 在log上會一直出現fan
因為會一直變換轉速
所以之前拿掉了 因為量太大
這次再加回去
grep Fan|grep fail
但要撈log時 使用cut時發現一個問題
當每個月的10號之前
會有二個空格

Apr  9 19:37:20 192.168.204.251 System: Fan 1 (from left when facing right side), failed

Apr和9間就有二個空格

如此便會影使用cut取值的正確
為了要解決這個問題
使用一次 tr 就好了

tr -s ' ' 這樣就可以把空格全部壓縮成一個