名稱:cut
  
  使用權限:所有使用者
  
  用法:cut -cnum1-num2 filename
  
  說明:顯示每行從開頭算起 num1 到 num2 的文字。
  
  範例:
  
   shell>> cat example
   test2
   this is test1
   shell>> cut -c0-6 example ## print 開頭算起前 6 個字元
   test2
   this i
  
   cut其實很有用
  -c m-n 表示顯示每一行的第m個字元到第n個字元。例如:
  
   ---------file-----------
   liubi 23 14000
  ---------file-----------
  # cut -c 3-9,12-20 file
  liubi 14000
  
  -f m-n 表示顯示第m欄到第n欄(使用tab分隔)。例如:
   ---------file-----------
  liubi 23 14000
  ---------file-----------
  # cut -f 1,3 file
  liubi 14000

本文自http://itlab.idcquan.com/linux/command轉貼

arrow
arrow
    文章標籤
    cut
    全站熱搜

    痞客興 發表在 痞客邦 留言(0) 人氣()