upper- to lower-case using sed

前端 未结 7 1036
别那么骄傲
别那么骄傲 2020-12-05 07:21

I\'d like to change the following patterns:

getFoo_Bar

to:

getFoo_bar

(note the lower b)

Knowing

7条回答
  •  [愿得一人]
    2020-12-05 08:10

    You can use perl for this one:

    perl -pe 's/(get[A-Z][A-Za-z0-9]*)_([A-Z])/\1_\l\2/'
    

    The \l is the trick here.

    sed doesn't do upper/lowercase on matched groups.

提交回复
热议问题