Advertisement
Guest User

Untitled

a guest
Feb 11th, 2016
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. /usr/xpg4/bin/awk 'c-->0;$0~s{if(b)for(c=b+1;c>1;c--)print r[(NR-c+1)%b];print;c=a}b{r[NR%b]=$0}' b=5 a=5 s="ERROR" file
  2.  
  3. stupid
  4. remove
  5.  
  6. keep it
  7. *
  8. MATCH
  9. keep it as well
  10.  
  11.  
  12.  
  13. remove
  14.  
  15. important
  16. *
  17. MATCH at line 2:
  18. needed
  19. also
  20.  
  21. this line should be kept
  22. *
  23. MATCH at line 2:
  24. this to save
  25. very important
  26.  
  27.  
  28.  
  29. remove
  30.  
  31. keep it
  32. *
  33. MATCH
  34. keep it as well
  35.  
  36. nonsense
  37. another nonsense
  38.  
  39. keep it
  40. keep it as well
  41. ---
  42. important
  43. needed
  44. also
  45. ---
  46. this line should be kept
  47. this to save
  48. very important
  49. ---
  50. keep it
  51. keep it as well
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement