Windows XP Windows 7 Windows 2003 Windows Vista Windows 綜合教學 Linux 系統教學
Windows 10 Windows 8 Windows 2008 Windows NT Windows Server 電腦軟體教學
您现在的位置: Windows教程網 >> Windows教程 >  >> Linux 系統教學 >> Linux 教學

Linux colrm 指令用法:移除檔案指定欄位

編輯:Linux 教學

colrm 從標準輸入讀取內容,移除指定欄位範圍後輸出至標準輸出,常用於文字處理管線。

語法

colrm [起始欄 [結束欄]]

範例

假設 text.file 內容為 123456789:

  • colrm 4 < text.file → 輸出 123(第 4 欄起全刪)。
  • colrm 4 6 < text.file → 輸出 123789(刪除第 4–6 欄)。
  • colrm 4 6 < text.file > text.file1 → 結果存入 text.file1。

欄位以字元為單位計算,非欄位分隔符號。配合管線可快速處理固定寬度文字資料。

Copyright © Windows教程網 All Rights Reserved