Guest User

Untitled

a guest
Jul 21st, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.32 KB | None | 0 0
  1. #!/usr/bin/ruby
  2.  
  3. newFile = ""
  4. pattern = /(span\-|append\-|prepend\-|push\-|pull\-)(\d+)/
  5. STDIN.each_line do |line|
  6.  
  7. if (matchData = line.scan(pattern))
  8. matchData.each do |match|
  9. number = match[1].to_i * 2
  10. line.sub!(match[0]+match[1], match[0] + number.to_s)
  11. end
  12. puts line
  13. else
  14. puts line
  15. end
  16. end
Add Comment
Please, Sign In to add comment