首页 > 系统相关 >linux 中 删除文件的最后一列以及若干列

linux 中 删除文件的最后一列以及若干列

时间:2023-09-12 17:33:07浏览次数:97  
标签:02 若干列 22 pc1 一列 linux test03 txt root

 

001、

[root@pc1 test03]# ls
a.txt
[root@pc1 test03]# cat a.txt      ## 测试数据
01      02      03      04      05      06      07      08      09      10
11      12      13      14      15      16      17      18      19      20
21      22      23      24      25      26      27      28      29      30
[root@pc1 test03]# awk '{OFS = "\t"; NF -= 1}1' a.txt      ## 删除最后一列
01      02      03      04      05      06      07      08      09
11      12      13      14      15      16      17      18      19
21      22      23      24      25      26      27      28      29
[root@pc1 test03]# awk '{OFS = "\t"; NF -= 2}1' a.txt
01      02      03      04      05      06      07      08
11      12      13      14      15      16      17      18
21      22      23      24      25      26      27      28
[root@pc1 test03]# awk '{OFS = "\t"; NF -= 5}1' a.txt       ## 删除最后5列
01      02      03      04      05
11      12      13      14      15
21      22      23      24      25

 

 

标签:02,若干列,22,pc1,一列,linux,test03,txt,root
From: https://www.cnblogs.com/liujiaxin2018/p/17697350.html

相关文章

  • Jmeter ServerAgent 修改端口,linux
     编辑serverAgent.sh,在后面加上  --udp-port端口--tcp-port端口比如  参考:https://blog.csdn.net/lemon_linaa/article/details/89963904......
  • 在Linux服务器上装jenkins(方式二:rpm包)
    官网下载jenkinshttps://www.jenkins.io/zh/download/上面比较慢,我们从清华大学开源镜像站下载安装包:https://mirrors.tuna.tsinghua.edu.cn/搜索jenkins后,选择redhat(也可以选择redhat-stable,这个是稳定版本,版本相对redhat目录下的要低一些)......
  • linux NFS报错 无法重启rpcbind
    Failedtoregister(statd,1,tcp6/udp):svc_reg()err:RPC:Remotesystemerror-Noroutetohost 解决方案:net.ipv6.conf.all.disable_ipv6=0net.ipv4.conf.all.accept_redirects=0vi/etc/sysctl.conf==>net.ipv6.conf.all.disable_ipv6=0==>net.ipv4.c......
  • linux用户和用户组权限设置
    查看当前用户whoami #要查看当前登录用户的用户名whoami #表示打开当前伪终端的用户的用户名who命令其它常用参数:-a打印能打印的全部-d打印死掉的进程-m同ami,momlikes-q打印当前登录用户数及用户名-u打印当前登录用户登录信息-r打印运行等级创建新用户addusernewn......
  • Linux 同步时间
    1、安装ntp通过buildroot安装ntp包2、查看时间date注:查看时区3、同步时间同步时间命令:ntpdate-untp-server注:ntpdate加上-u参数同步,否则会出现如下错误:noserversuitableforsynchronizationfound。4、可使用的ntp服务器NTP服务器(上海):ntp.api.bz中国国家授......
  • Linux中如何切割文件?
    很多时候由于文件过大、网络传输存在限制,因此我们需要对大文件进行切割,将大文件切割成多个小文件再进行传输。那么Linux中如何切割文件?Linux切割文件的方法有很多,以下是常用的方法。1、使用split命令split命令是一种常用的切割文件的工具。它可以将一个大文件切割成多......
  • 解决Linux平台下R的报错问题
    安装BiocManagerinstall.packages("BiocManager")加载library(BiocManager)安装ggplot2install.packages("ggplot2")**byte-compileandpreparepackageforlazyloading错误:package‘cli’wasinstalledbeforeR4.0.0:pleasere-installit停止执行......
  • Linux中恢复仍在活动进程中的已删除文件!
    许多情况下,删除的文件都可以恢复,比如在该文件有活动的进程在操作它,并且目前被单个或多个用户使用时。在 Linux 系统中,每个当前正在运行的进程都会获得ID,其被称之为进程标识符“PID”,并将它们存放在/proc目录中。这正是我们恢复仍在运行的进程中(具有PID)已删除的文件所需要的......
  • linux(centos7)安装防火墙firewalld及开放端口相关命令
    安装firewalld防火墙命令:yuminstallfirewalld  安装完成,查看防火墙状态为notrunning,即未运行,输入命令开启:  添加开放端口:   防火墙相关命令: 查看防火墙状态systemctlstatusfirewalld.service 打开防火墙systemctlstartfirewalld.service 关闭......
  • linux中使用core dumped获取程序崩溃信息
    //打开linux的coredumpedulimit-cunlimited//ubuntu需要手动设置下生成路径sudosysctl-wkernel.core_pattern=$PWD/core执行一次可执行程序./a.outsegmentationfault(coredumped)然后gdb查看崩溃信息gdba.outcore.****core.xxx就是dumped文件......