Created
March 26, 2013 15:55
-
-
Save judy2k/5246544 to your computer and use it in GitHub Desktop.
The hackiest script in the world - anything that looks like an int in the input, replace with double its value and output to stdout. Use as follows (on OSX): 1. Copy the json data you want to double from your IDE 2. pbcopy | ./double.py | pbpaste 3. Paste the new json with all the numbers doubled back into your IDE
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| import re | |
| import sys | |
| def rep(sval): | |
| return str(int(sval.group()) * 2) | |
| if __name__ == '__main__': | |
| print re.sub(r'\d+', rep, sys.stdin.read()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment