sed 命令

将 log 文件中,以 Time 开头的行,输出到 time.log


sed -n '/^Time/p' log > time.log 

将 log 文件中,以 ) 结尾的行,输出到 fo.log


sed -n '/)$/p' log > fo.log 

单引号之间 /)$/p 为命令,/ 为分隔符,) 表明需要查找的字符是 ),$ 表示行尾,^ 则表示行开头。

   Send article as PDF   

Leave a Reply

Your email address will not be published. Required fields are marked *

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.