1. translate upper case alphabets to lower case alphabets
# echo "ABCD" | tr [:upper:] [:lower:]
abcd
2. 如何將 dos 檔案格式轉換 unix ? (by using "tr" command)
unix或linux主機上會呈現^M的記號(於windows系統為跳行),
如何執行dos2unix的程序進行格式轉換?
# vi dosfile ==> extra characters in the tailing of each line
aaa^M
bbbb^M
ccccc^M
^Z
use "tr" command to delete the tailed characters
# tr -d "\015\032" <> unixfile
# vi unixfile ==> it is ok now
aaa
bbbb
ccccc
3.
去处^M的方法 tr -s "\015" "\n"
出去M Z的方法 tr -s "\015\032" "\n"
沒有留言:
張貼留言