Advertisement
Guest User

Untitled

a guest
Nov 14th, 2012
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.28 KB | None | 0 0
  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
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement