How can I emulate 'grep -B' functionality in Perl?

后端 未结 3 1023
梦谈多话
梦谈多话 2021-01-20 10:45

I have been searching for a solution that allows me to search the lines of an array, and if a string match is made, push that line and the 2 previous lines into an array. It

3条回答
  •  隐瞒了意图╮
    2021-01-20 11:24

    You are mixing up the grep program /bin/grep with the perl function named grep (perldoc -f grep). While the former takes additional parameters, like -B, the latter does not.

提交回复
热议问题