Skip to content

Instantly share code, notes, and snippets.

@bukzor
Created March 22, 2016 21:37
Show Gist options
  • Save bukzor/17dbe08ac1adb2926121 to your computer and use it in GitHub Desktop.
Save bukzor/17dbe08ac1adb2926121 to your computer and use it in GitHub Desktop.
# Simulate two slowly-running batch jobs:
slow() {
# print stdout at 10bps
pv -qL 10
}
timestamp() {
# prefix stdin with a sortable timestamp
tai64n
}
seq 99 | slow | timestamp > seq.1 &
seq 100 199 | slow | timestamp > seq.2 &
# I'd like to see the combined output of those two logs, in timestamp-sorted order
# This gets the job done, but waits till both jobs have stopped:
sort -sm seq.1 seq.2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment