Sed print between patterns the first match result

前端 未结 2 872
忘掉有多难
忘掉有多难 2021-01-29 06:04

the file like:

File /home/user/

int yl_init(void);

File /home/user/

int yl2_init(void);

I want u

2条回答
  •  遥遥无期
    2021-01-29 07:05

    You can use a the q command to cause sed to exit when the second pattern is matched:

    sed -n '/File/,$p;/;/q'
    

提交回复
热议问题