關於 PHP, Linux, Open Source 及個人生活記載的網誌。
RSS icon
  • Linux: 將檔案的 Tabs 字元用空白取代

    Posted on March 11th, 2010 Sam Tang No comments

    在 Linux 下有一個工具 “expand”,它可以將檔案內所有 tabs 字元轉換為空白字元, 用法如下:

    expand input.file > output.file
    expand data.txt > output.txt
    expand -t 2 data.txt > output.txt

    上面第三行的參數 -t 是定義用多少個空白字元取代 tabs。而另一個工具 “unexpand” 則與 “expand” 剛剛相反, 是將空間字元轉換為 tabs 字元。


    Leave a reply

    *
    To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
    Click to hear an audio file of the anti-spam word