Skip to main content
14 events
when toggle format what by license comment
May 18, 2021 at 11:46 comment added muru @jno well, yes, that's why I gave an example of process substitution that readers can adapt to run whatever command they want, instead of worrying about premature optimization on sed calls.
May 18, 2021 at 11:38 comment added jno @muru, the use of ts (as well as, say, cat -n to number lines) is the same as sed — just another filter. I meant the original question for arbitrary prefix insertion. The exact choice obviously depends on what one want to insert (static text, "serializers" like line numbers and stamps, or something even more "dynamic") and expected output rate.
May 18, 2021 at 11:28 comment added muru @jno the thought of running a date for each line instead of having a long-running ts which processes all lines.
May 18, 2021 at 11:27 comment added jno @muru, who keeps you from usung, say, $(date) instead of mere $PREFIX?
May 18, 2021 at 10:04 comment added muru @jno depends on the prefix. Something like ts could be used for nicely timestamped output.
May 18, 2021 at 9:57 comment added jno If the job is only add a prefix, I'd save on sed call with something like while read -r; do echo "$PREFIX$REPLY"; done
S Jan 9, 2021 at 6:21 history suggested user385186 CC BY-SA 4.0
make subshell ignore termination signals to keep file descriptor open in order to let the script exit properly
Jan 9, 2021 at 3:31 review Suggested edits
S Jan 9, 2021 at 6:21
Apr 28, 2018 at 3:39 comment added muru @SergiyKolodyazhnyy I think the dupe candidate suggested by you and the possible dupe for that question are good for that - both have some discussion on retaining ordering of the output.
Apr 28, 2018 at 1:47 comment added Sergiy Kolodyazhnyy @CharlesDuffy Do you have any extra information on that ? A couple links perhaps ?
Apr 27, 2018 at 19:54 comment added Charles Duffy Note that doing this one loses the guarantee that ordering will be consistent between the two streams -- if you write, say, five lines to stdout, one line to stderr, and five more lines to stdout, it's not at all guaranteed that the line written to stderr will have five stdout lines before it and five after it when it finally gets flushed.
Apr 27, 2018 at 14:53 history edited muru CC BY-SA 3.0
deleted 4 characters in body
Apr 27, 2018 at 14:40 vote accept Magicloud
Apr 27, 2018 at 14:36 history answered muru CC BY-SA 3.0