zoukankan      html  css  js  c++  java
  • linux系统中删除文件的第一列

    1、测试数据

    [root@centos79 test]# cat a.txt
    e t q t
    x g a w
    i k h e

    2、cut删除

    [root@centos79 test]# cat a.txt
    e t q t
    x g a w
    i k h e
    [root@centos79 test]# cut -d " " -f 2- a.txt
    t q t
    g a w
    k h e

    3、sed删除

    [root@centos79 test]# cat a.txt
    e t q t
    x g a w
    i k h e
    [root@centos79 test]# sed 's/[^ ] //' a.txt
    t q t
    g a w
    k h e

    4、awk删除

    [root@centos79 test]# cat a.txt
    e t q t
    x g a w
    i k h e
    [root@centos79 test]# awk '{$1 = "";print $0}' a.txt
     t q t
     g a w
     k h e
    [root@centos79 test]# awk '{$1 = "";print $0}' a.txt | sed 's/^[	 ]*//g'
    t q t
    g a w
    k h e

    5、awk删除

    [root@centos79 test]# cat a.txt
    e t q t
    x g a w
    i k h e
    [root@centos79 test]# awk '{for(i = 2; i <= NF; i++) printf("%s ", $i); printf("
    ")}' a.txt
    t q t
    g a w
    k h e
  • 相关阅读:
    Basic knowledge of html (keep for myself)
    科学技术法转成BigDemcial
    SimpleDateFormat
    log4j 配置实例
    R 实例1
    yield curve
    if-else的优化举例
    十二、高级事件处理
    十一、Swing
    十、输入/输出
  • 原文地址:https://www.cnblogs.com/liujiaxin2018/p/15022433.html
Copyright © 2011-2022 走看看