Created
January 24, 2014 05:44
-
-
Save nickjacob/8592571 to your computer and use it in GitHub Desktop.
bash function to prepend text to output of script (example use in here too)
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
function label_stream() | |
{ | |
perl -sne '$|=1; print "[$cmd]\t$_"' -- -cmd="$1" | |
} | |
# example use | |
ls -lafh . | label_stream "ls" | |
# output | |
[ls] drwxr-xr-x 6 nickjacob staff 204B Nov 11 2012 Processing/ | |
[ls] drwxr-xr-x 6 nickjacob staff 204B Dec 4 2012 progress/ | |
[ls] drwxr-xr-x 5 nickjacob staff 170B Nov 19 2011 Projects/ | |
[ls] drwxr-xr-x 3 nickjacob staff 102B Oct 24 00:10 queer_1.oo3/ | |
[ls] drwxr-xr-x 3 nickjacob staff 102B Dec 8 13:10 Queer_Final.oo3/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment