Perl: How to print next line after matching a pattern?

后端 未结 7 2011
刺人心
刺人心 2021-01-06 15:52

I would like to print specific data after matching a pattern or line. I have a file like this:

#******************************    
List : car  
Design: S           


        
7条回答
  •  情歌与酒
    2021-01-06 15:54

    a shell one-liner to do the same thing

    echo "Car Type            No.  "; \
        grep -A 2 Type data.txt \
        | grep -v -E '(Type|-)' \
        | grep -o -E '(\w+ *\w+)'
    

提交回复
热议问题