Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Nov 14th, 2012  |  syntax: None  |  size: 0.28 KB  |  views: 26  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. START
  2. ...
  3. ...
  4. END
  5. START
  6. ...
  7. ...
  8. END
  9.        
  10. sed '/START/,/END/{/START/{h;d};H;/END/{g;s/.../foo/gp};d}' file
  11. START
  12. foo
  13. foo
  14. END
  15. START
  16. foo
  17. foo
  18. END
  19.        
  20. awk '/START/{p=1;n++};p{if(n==1)sub(/.../,"foo");if(n==2)sub(/.../,"bar");print};/END/{p=0}' file
  21. START
  22. foo
  23. foo
  24. END
  25. START
  26. bar
  27. bar
  28. END