1.已知文件test.txt内容为:

  test

  liyao

  oldboy

 请给出打印test.txt内容时,不包含oldboy内容的命令

  解答:

  步骤:生成test.txt文件

  cat >>test.txt<<EOF

  >test

  >liyao

  >oldboy

  <<EOF

  方法一:

  head -2 test.txt

  方法二:

  grep 

    grep -v "oldboy" test.txt

  方法三:

  sed '/oldboy/d' test.txt

 

posted on 2016-12-07 17:37  金翅大鹏吃唐僧  阅读(125)  评论(0)    收藏  举报