Return a regex match in a Bash script, instead of replacing it

前端 未结 9 958
面向向阳花
面向向阳花 2021-01-31 04:30

I just want to match some text in a Bash script. I\'ve tried using sed but I can\'t seem to make it just output the match instead of replacing it with something.



        
9条回答
  •  耶瑟儿~
    2021-01-31 04:36

    Use grep. Sed is an editor. If you only want to match a regexp, grep is more than sufficient.

提交回复
热议问题