Skip to main content
2 of 4
POSIXified
Stéphane Chazelas
  • 586.2k
  • 96
  • 1.1k
  • 1.7k

With awk

awk 'x&&/S/{exit};x+=/R/' file 

Example

seq 20 | awk 'x&&/1/{exit};x+=/6/' 6 7 8 9 
user78605