--table-noextreme
옵션은 어떻게 column
작동하나요?
-E, --table-noextreme columns Specify columns where is possible to ignore unusually long (longer than average) cells when calculate column width. The option has impact to the width calculation and table formatting, but the printed text is not affected.
$ cat table.md
Lorem ipsum | Lorem ipsum dolor sit amet | Lorem ipsum dolor sit amet | Lorem ipsum dolor sit amet
Lorem | Lorem ipsum | Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut | Lorem ipsum dolor
Lorem | Lorem ipsum dolor | Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do | Lorem
$ column -t -s '|' -o '|' < table.md
Lorem ipsum | Lorem ipsum dolor sit amet | Lorem ipsum dolor sit amet | Lorem ipsum dolor sit amet
Lorem | Lorem ipsum | Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut | Lorem ipsum dolor
Lorem | Lorem ipsum dolor | Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do | Lorem
$ column -t -s '|' -o '|' --table-noextreme 3 < table.md
Lorem ipsum | Lorem ipsum dolor sit amet | Lorem ipsum dolor sit amet | Lorem ipsum dolor sit amet
Lorem | Lorem ipsum | Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut | Lorem ipsum dolor
Lorem | Lorem ipsum dolor | Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do | Lorem
테이블을 다음과 같이 형식화하려면 어떻게 해야 합니까?
Lorem ipsum | Lorem ipsum dolor sit amet | Lorem ipsum dolor sit amet | Lorem ipsum dolor sit amet
Lorem | Lorem ipsum | Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut | Lorem ipsum dolor
Lorem | Lorem ipsum dolor | Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do | Lorem
(util-linux 2.37.2/arch의 열)
답변1
예제 데이터에는 트리거 효과가 없습니다 -E
. 아마도 세 번째 열의 값이 "비정상적으로 길다"고 판단할 수 없기 때문일 것입니다.
다음 수정된 예제 텍스트를 사용하세요.
Lorem ipsum | Lorem ipsum dolor | Lorem | Lorem ipsum dolor sit
Lorem ipsum dolor | Lorem | Lorem ipsum dolor sit amet, consectetur | Lorem
Lorem | Lorem ipsum | Lorem | Lorem ipsum dolor sit
터미널 너비가 80열이면 다음과 같은 결과를 얻습니다.
$ column -t -s \| -o \| file
Lorem ipsum | Lorem ipsum dolor | Lorem | Lorem ipsum dolor sit
Lorem ipsum dolor | Lorem | Lorem ipsum dolor sit amet, consectetur | Lorem
Lorem | Lorem ipsum | Lorem
(행이 여러 줄에 걸쳐 있음) 및
$ column -t -E 3 -s \| -o \| file
Lorem ipsum | Lorem ipsum dolor | Lorem | Lorem ipsum dolor sit
Lorem ipsum dolor | Lorem | Lorem ipsum dolor sit amet, consectetur
| | | Lorem
Lorem | Lorem ipsum | Lorem | Lorem ipsum dolor sit
그러나 예상되는 결과를 고려하면 -l
( --table-columns-limit
) 옵션이 원하는 것 같습니다.
$ column -t -l 3 -s \| -o \| file
Lorem ipsum | Lorem ipsum dolor | Lorem | Lorem ipsum dolor sit
Lorem ipsum dolor | Lorem | Lorem ipsum dolor sit amet, consectetur | Lorem
Lorem | Lorem ipsum | Lorem | Lorem ipsum dolor sit