coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: feature request: self join from stdin


From: Nomen Nescio
Subject: Re: feature request: self join from stdin
Date: Sun, 20 Oct 2019 10:52:42 +0200 (CEST)

Do you think the following coproc solves the problem?
A join or paste prints expected results.
Curiously cat or tac will block the process.
Can you explain why join/paste finish the process whereas cat/tac block it?

# ii  bash           4.4-5        amd64        GNU Bourne Again SHell
# ii  coreutils      8.26-3       amd64        GNU core utilities
seq 100000 |
{
    coproc { cat; } && exec 3<&${COPROC[0]}- 4<&${COPROC[1]}-
    coproc { cat; } && exec 5<&${COPROC[0]}- 6<&${COPROC[1]}-
    tee >(cat >&4) > >(cat >&6) & exec 4>&- 6>&-

    join <(cat <&3) <(cat<&5)    ## GOOD
    # paste <(cat <&3) <(cat<&5) ## GOOD
    # cat <(cat <&3) <(cat <&5)   ## BAD
    # tac <(cat <&3) <(cat<&5)   ## BAD
    # cat <(cat <&3) & cat <(cat <&5) &  ## GOOD
    wait
}



reply via email to

[Prev in Thread] Current Thread [Next in Thread]