Created
July 20, 2012 18:44
-
-
Save jkoppe/3152499 to your computer and use it in GitHub Desktop.
add timestamps with perl
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
jkoppe@localhost in ~ at 2012-07-20 13:43:47 | |
--> echo something | |
something | |
jkoppe@localhost in ~ at 2012-07-20 13:43:50 | |
--> echo something | timestamp | |
Fri Jul 20 13:43:54 2012 something | |
jkoppe@localhost in ~ at 2012-07-20 13:43:54 | |
--> |
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
#!/usr/bin/perl | |
# Don't buffer output | |
$| = 1; | |
# Prefix a timestamp to our input lines | |
while (<>) { | |
print scalar localtime, " $_" ; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment