Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/ruby
- newFile = ""
- pattern = /(span\-|append\-|prepend\-|push\-|pull\-)(\d+)/
- STDIN.each_line do |line|
- if (matchData = line.scan(pattern))
- matchData.each do |match|
- number = match[1].to_i * 2
- line.sub!(match[0]+match[1], match[0] + number.to_s)
- end
- puts line
- else
- puts line
- end
- end
Add Comment
Please, Sign In to add comment