How to escape a single quote inside awk

前端 未结 5 662
攒了一身酷
攒了一身酷 2020-11-28 20:11

I want do the following

awk \'BEGIN {FS=\" \";} {printf \"\'%s\' \", $1}\'

But escaping single quote this way does not work



        
5条回答
  •  半阙折子戏
    2020-11-28 20:38

    A single quote is represented using \x27

    Like in

    awk 'BEGIN {FS=" ";} {printf "\x27%s\x27 ", $1}'
    

    Source

提交回复
热议问题