TL; DR
Prendi in considerazione l'utilizzo di una combinazione di paste/ columnpiuttosto che prper ottenere risultati più coerenti.
A seconda del tuo sistema operativo, prmescola erroneamente le colonne quando le lunghezze di input differiscono (Ubuntu, macOS) o peggio ancora stamperanno ogni input su pagine completamente diverse (Centos 7)
pr antepone e accoda output esterno
FORMATO:
paste <(cmd1) <(cmd2) | column -s $'\t' -t
Spiegazione dettagliata
Una soluzione altamente affidabile è possibile attraverso una combinazione dei comandi pastee column.
Vantaggi dell'approccio paste/ columnrispetto a pr:
Output più pulito a causa della mancanza di data / ora delle informazioni dell'intestazione della pagina, né della visualizzazione di uno schermo intero di righe vuote
Le colonne rimangono sempre separate anche quando le lunghezze di input sono diverse
Esempio concreto:
paste <(ls -1 .) <(ls -1 ..) | column -s $'\t' -t
Output di paste/ columntecnica nella vita reale su Ubuntu 16.04:
jay-z@jaytaylor.com:~/go/src/github.com/jaytaylor/html2text
$ paste <(ls -1 .) <(ls -1 ..) | column -s $'\t' -t
LICENSE archiveify
README.md go-hostsfile
html2text.go html2text
html2text_test.go jaytaylor
testdata mockery-example
shipbuilder
stoppableListener
tesseract-web
Per confronto: prsu varie piattaforme
TL; DR: il pr comportamento è incoerente tra le versioni di Linux.
Uscita della prversione su Ubuntu :
jay-z@jaytaylor.com:~/go/src/github.com/jaytaylor/html2text
$ pr -m <(ls -1 .) <(ls -1 ..)
2017-05-25 15:50 /dev/fd/62 Page 1
LICENSE archiveify
README.md go-hostsfile
html2text.go html2text
html2text_test.go jaytaylor
testdata mockery-example
shipbuilder
stoppableListener
tesseract-web
Uscita della prversione su OS X / macOs :
jay-z@jaytaylor.com:~/go/src/github.com/jaytaylor/html2text
$ pr -m <(ls -1 .) <(ls -1 ..)
May 25 08:55 2017 Page 1
LICENSE archiveify
README.md go-hostsfile
html2text.go html2text
html2text_test.go jaytaylor
testdata mockery-example
shipbuilder
stoppableListener
tesseract-web
<... remainder of screen filled with blank lines ...>
Uscita della prversione su Centos :
(Sorprendentemente, il comportamento di prCentos 7 differisce da quello di tutte le altre piattaforme testate)
jay-z@jaytaylor.com:~/go/src/github.com/jaytaylor/html2text
$ pr <(ls -1 .) <(ls -1 ..)
2017-05-25 15:59 /dev/fd/63 Page 1
LICENSE
README.md
html2text.go
html2text_test.go
testdata
<... remainder of screen filled with blank lines ...>
2017-05-25 16:21 /dev/fd/62 Page 1
archiveify
go-hostsfile
html2text
jaytaylor
mockery-example
shipbuilder
stoppableListener
tesseract-web
<... remainder of screen filled with blank lines ...>
pr -muno può usarepaste.