Created
May 27, 2013 14:13
-
-
Save lsd/5657282 to your computer and use it in GitHub Desktop.
mta
This file contains 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
# one-liner example: | |
# perl -e '$r="1346518,CLOSED,04/09/2013 12:00:00 AM,136 EAST 27 STREET,1018152,555,,49,SPOPS,05/24/2013 12:00:00 AM,A8,05/22/2013 12:00:00 AM"; print "$r (orig)\n"; $rand=int(rand 5)+1; $r =~ s/(,[0-9]{7},)[0-9]+(,,..)/\1$rand\2/; print $r;' | |
# I broke it up into lines to make it easier to understand | |
$rand = int(rand 5) + 1; | |
$row = "1346518,CLOSED,04/09/2013 12:00:00 AM,136 EAST 27 STREET,1018152,555,,49,SPOPS,05/24/2013 12:00:00 AM,A8,05/22/2013 12:00:00 AM"; | |
print "$row (old)\n"; | |
$row =~ s/(,[0-9]{7},)[0-9]+(,,..)/\1$rand\2/; | |
print "$row (new)\n"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment