Regular expression to extract header name from c file

后端 未结 3 1303
南笙
南笙 2021-01-28 02:29

How to extract headers from a c file that contains them like this?

#include 
#include    
#include   
         


        
3条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-28 02:46

    Try:

    awk '{match($0,/[<"].*[>"]/);print substr($0,RSTART+1,RLENGTH-2)}' Input_file
    

提交回复
热议问题