On 01/15/24 03:14PM, Greg Reagle wrote:
> I didn't know that you could use the shell like this.  What a delightful 
> surprise.  Here is the code for bash/dash:
> ....
> command | (read -r; printf "%s\n" "$REPLY"; sort)
> ....

Thanks for sharing.
This is neat, however, it gets really gay when multiple processes buffer stdin.

For example, to comma-deliminate the header & sort output:

```
./program-cli --with-header --no-pager --output-file=/dev/stdout |
        (awk '{ IFS="\t"; OFS=","; print; exit }'; sort)
```

  :(


It's pretty clear that "header" information is just noise & should EITHER
be written:
        - if stdout is a tty
        OR
        - only to standard error

Jeremy

Reply via email to