Shell脚本 - 如何用空字符串替换第一行字符串?

时间:2015-07-21 09:15:08

标签: shell

我想在shell脚本中用空字符串替换第一行?

例如:

输入

Skipping HTTPS certificate checks altogether. Note that this is not secure at all. 
Line 2 ......
Line 3 ......

输出

Line2
Line3

我可以用什么Unix命令来执行相同的操作?有什么想法吗?

3 个答案:

答案 0 :(得分:2)

你也可以在下面使用

yourcommand | awk 'NR>1'

yourcommand | tail -n+2

答案 1 :(得分:1)

如果它在文件中,您可以使用它来删除第一行:

sed -i '1d' ../file.txt

答案 2 :(得分:0)

你的意思是,你想要输出基本上等于输入,但第一行被删除?这是通过Unix命令' tail'

来完成的

来自尾巴的手册页:

    -n, --lines=K
          output the last K lines, instead of the last 10; or use -n +K to output starting with
          the Kth
相关问题