發表文章

目前顯示的是 9月, 2008的文章

[linux]如何還原 8bit 字串

在我的某個檔案中有 \346\226\260\351\200\262 這樣的字串 雖然知道它是 8bit 字串 可是處理起來還是很麻煩 我自己還有綜合幾個網友,一共找到了這幾個方法 1. echo "echo "\$\'`cat file`\' | bash 2. eval echo "$'$(< test.txt)'" 3. /bin/echo -e `cat file` 註:第1種和第2種的在檔案中有一堆單引號就會出錯了 第3種中使用的 echo 非 bash 中內建的 echo 而是 coreutils中的echo 雖然很希望可以在 tail 中使用,但試不出來,只能先這樣了