sed - what is this curly brace notation called?

前端 未结 1 1256
Happy的楠姐
Happy的楠姐 2021-01-01 06:12

I just found this:

sed \'/label/{n;n;s/{}/{some comment}/;}\'

The intended effect is to seek label, proceed 2 lines down (

相关标签:
1条回答
  • 2021-01-01 07:02

    Curly brackets allow to group several commands so that they are executed for the same address range (reference). The thing here is that you specify an address (with one or two line numbers or patterns) and then apply a group of commands to matching lines.

    The n command is nothing special, and it's documented in man, as well as in the linked document. I'm not sure if there's a general name for it.

    From man sed:

    n N Read/append the next line of input into the pattern space.

    0 讨论(0)
提交回复
热议问题