zoukankan      html  css  js  c++  java
  • Shell基本语法---处理海量数据的cut命令

    cut命令

    • cut应用场景:通常对数据进行列的提取

    • 语法:cut [选项] [file]

      • -d #指定分割符

      • -f #指定截取区域

      • -c #以字符为单位进行分割

     1 # 以':'为分隔符,截取出/etc/passwd的第一列跟第三列
     2 cut -d ':' -f 1,3 /etc/passwd
     3 
     4 # 以':'为分隔符,截取出/etc/passwd的第一列到第三列
     5 cut -d ':' -f 1-3 /etc/passwd
     6 
     7 # 以':'为分隔符,截取出/etc/passwd的第二列到最后一列
     8 cut -d ':' -f 2- /etc/passwd
     9 
    10 # 截取/etc/passwd文件从第二个字符到第九个字符
    11 cut -c 2-9 /etc/passwd
  • 相关阅读:
    洛谷
    洛谷
    模板
    模板
    模板
    模板
    模板
    洛谷
    洛谷
    模板
  • 原文地址:https://www.cnblogs.com/chusiyong/p/11273867.html
Copyright © 2011-2022 走看看