sed 取行,替换

sed 取特定行

sed -n ‘1,2p’ infile  #print line 1 to 2

sed -n '2,$p' file  ##print line 2 to end of line

sed '/pattern/!p' infile  ## 匹配pattern的行不输出

 sed -n -e '/build/p' /etc/cli.cfg  p-打印行 n - e --e<script>或--expression=<script>:以选项中的指定的script来处理输入的文本文件

sed 替换:

sed -i "s/ / /g" COVID19-284.301.all.Severity_binary.ALL_1.SAIGE.vcf.genotype.txt.tst # 把文件中空格替换为

注:其他方式取第二行-末尾的方法

1. cat filename | tail -n +2 即tail -n +K    # use -n +K to output lines starting with the Kth

2.awk '{if(NR!=1) print }' filename

本文来自博客园,作者:BioinformaticsMaster,转载请注明原文链接:https://www.cnblogs.com/koujiaodahan/p/13636761.html

原文地址:https://www.cnblogs.com/koujiaodahan/p/13636761.html