Skip to main content
1 of 2
Dani_l
  • 5.2k
  • 2
  • 21
  • 34

sed seems like the right tool:

sed -i '/radius-server/!b;n;n;d' filename 

How it works:

/radius-server/!b # as long as it's NOT 'radius-server' do nothing (branch to end) n # read next line (replace current line with next line) n # same as above - we now read 2 lines d # delete the current line 
Dani_l
  • 5.2k
  • 2
  • 21
  • 34