How to print matched regex pattern using awk?

后端 未结 8 679
说谎
说谎 2020-11-29 15:56

Using awk, I need to find a word in a file that matches a regex pattern.

I only want to print the word matched with the pattern.

So if

8条回答
  •  谎友^
    谎友^ (楼主)
    2020-11-29 16:51

    Off topic, this can be done using the grep also, just posting it here in case if anyone is looking for grep solution

    echo 'xxx yyy zzze ' | grep -oE 'yyy'
    

提交回复
热议问题