jtab

   jtab

  사용법


       jtab -G fn1,fn2,fn3 [-T][-n subtitle][-c bgcolor][-S skiplist][-d del][-t title]
            [-a fn [{-N subtitle | -u}] -A names][-h]][-s][-C names][-R names] [file]
       jtab -G fn1,fn2,fn3 -P [-n subtitle][-S skiplist][-d del][-t title]
            [-a fn [-A names]][-h][-s][-C names][-R names] [file]
       jtab -V

	Options are as follows:

	-?              print this help
	-a fn           additional field
	-A names        selected names for -a fn field (separated by comma)
	-C names        selected names for -G fn1 field (separated by comma)
	-c bgcolor      background color for column and row name
	-d del          field delimiter; def: whitespace
	-G fn1,fn2,fn3  select fields: fn1 is column. fn2 is row. fn3 is data; exam) 1,2,3
	-h              print header info for each additional selection with -a option
	-n subtitle     specify left cornor title
	-N subtitle     specify the most left cornor title with -a option
	-P              print data as plain text format
	-R names        selected names for -G fn2 field (separated by comma)
	-s              don't not print rows of no data
	-S skiplist     list starting word to skip (separated by comma)
	-T              print table only
	-t title        specify top title
	-u              print name of fn on the top with -a option; default: on the left
	-V              show version

	file            data file; If file is omitted, the standard input is used.
  설명

jtab 명령어는 구분자로 분리된 데이타를 읽어서 HTML의 형식으로 table을 출력한다. 입력 파일명을 지정하지 않으면 표준입력이 사용된다.
다음은 kstat 명령어로 ce 네트웍 인터페이스 정보를 출력하여 egrep 명령어로 ipackets64, opackets64, rbytes64, obytes64를 추출하여, tr 명령어로 TAB을 콜론으로 변경하여 파일에 저장한다. 이렇게 저장된 데이타는 jtab 명령어의 입력으로 사용한다.

# kstat -p ce | egrep 'ipackets64|opackets64|rbytes64|obytes64' | tr '\t' : > output
# cat output
ce:0:ce0:ipackets64:102441
ce:0:ce0:obytes64:24117394
ce:0:ce0:opackets64:111255
ce:0:ce0:rbytes64:14884687
ce:1:ce1:ipackets64:72527
ce:1:ce1:obytes64:26244879
ce:1:ce1:opackets64:84249
ce:1:ce1:rbytes64:9296584
ce:2:ce2:ipackets64:1679135
ce:2:ce2:obytes64:5543200
ce:2:ce2:opackets64:26219
ce:2:ce2:rbytes64:323122974
ce:3:ce3:ipackets64:0
ce:3:ce3:obytes64:0
ce:3:ce3:opackets64:0
ce:3:ce3:rbytes64:0
#

위에 수집된 데이타에 다음과 같이 jtab 명령어를 사용하여 HTML 페이지를 만들었다.

# jtab -d : -G 3,4,5 output > out.html
다음은 out.html 파일의 내용이다:
+ ce0ce1ce2ce3
ipackets641024417252716791350
obytes64241173942624487955432000
opackets6411125584249262190
rbytes641488468792965843231229740

-G 옵션에 3개의 필드 번호를 지정하는데, 첫번째 필드는 컬럼명으로 사용될 필드 번호이고, 두번째 필드는 열명(row name)으로 사용될 필드 번호이고, 세번째 필드는 데이타로 사용될 필드 번호이다.
다음은 output 파일에 구분자를 콜론(:)으로 사용하여 3번째 필드를 테이블의 컬럼명으로 사용하고 4번째 필드를 열명(row name)으로 사용하고 5번째 필드를 데이타로 사용하여 HTML table을 만든다. -d 옵션으로 필드의 구분자를 지정한다.

다음은 -R 옵션에 열명을 지정하여 원하는 데이타에 대해서만 테이블을 만든다.

# jtab -d : -R ipackets64,opackets64 -G 3,4,5 output > out.html
다음은 out.html 파일의 내용이다:
+ ce0ce1ce2ce3
ipackets641024417252716791350
opackets6411125584249262190

다음은 -C 옵션에 컬럼명을 지정하여 원하는 데이타에 대해서만 테이블을 만든다.

# jtab -d : -C ce0,ce1 -G 3,4,5 output > out.html
다음은 out.html 파일의 내용이다:
+ ce0ce1
ipackets6410244172527
obytes642411739426244879
opackets6411125584249
rbytes64148846879296584

다음은 -G 옵션에서 컬럼과 열의 순서를 바꾸어 jtab 명령어를 실행한 결과이다.

# jtab -d : -G 4,3,5 output > out2.html
다음은 out2.html 파일의 내용이다:
+ ipackets64obytes64opackets64rbytes64
ce01024412411739411125514884687
ce17252726244879842499296584
ce21679135554320026219323122974
ce30000

-n 옵션을 사용하여 다음과 같이 왼쪽 상단의 컬럼명, interface 를 지정하였다.

# jtab -n interface -d : -G 4,3,5 out > out3.html
다음은 out3.html 파일의 내용이다:
interface ipackets64obytes64opackets64rbytes64
ce01024412411739411125514884687
ce17252726244879842499296584
ce21679135554320026219323122974
ce30000

-P 옵션을 사용하면 HTML 형식의 출력이 아닌, 텍스트 형식으로 출력한다.

# jtab -d : -P -G 3,4,5 output
         +      ce0      ce1       ce2 ce3
ipackets64   102441    72527   1679135   0
  obytes64 24117394 26244879   5543200   0
opackets64   111255    84249     26219   0
  rbytes64 14884687  9296584 323122974   0

-a 옵션으로 또하나의 필드를 지정하여 포괄적인 큰 table를 만들 수 있다.
위의 예제에서 만든 output 파일과 같은 형식의 데이타가 각각 시스템명으로 파일있는 디렉토리에서 다음과 같이 grep 명령어를 실행하면 각각의 각 라인 앞에 파일명과 콜론(:)을 붙은 out 파일이 만들어 진다.
이 out 파일에 -a옵션을 사용하여 추가적을 필드를 지정하여 큰 테이블을 만든다.

#  ls -l
dbserv    mailserv  webserv
# grep . dbserv mailserv webserv > out
# jtab -d : -G 4,5,6 -a 1 -N host -n interface out > out4.html
다음은 out4.html 파일의 내용이다:
hostinterface ce0ce1ce2ce3
dbservipackets641024417252716791350
obytes64241173942624487955432000
opackets6411125584249262190
rbytes641488468792965843231229740
mailservipackets64102388393016791512897
obytes642389002298795543207839
opackets649393084849261934860
rbytes64593930384958894297458920
webservipackets6424415277913583905
obytes64117394244879432002380
opackets64125524921982908
rbytes648846879658431229742894

-u 옵션을 지정하여 -a 옵션으로 추가 지정한 필드를 상위에 라인으로 구분한다.

#  ls -l
dbserv    mailserv  webserv
# grep . dbserv mailserv webserv > out
# jtab -u -d : -G 4,5,6 -a 1 -N host -n interface out > out5.html
다음은 out5.html 파일의 내용이다:
dbserv
interface ce0ce1ce2ce3
ipackets641024417252716791350
obytes64241173942624487955432000
opackets6411125584249262190
rbytes641488468792965843231229740
mailserv
ipackets64102388393016791512897
obytes642389002298795543207839
opackets649393084849261934860
rbytes64593930384958894297458920
webserv
ipackets6424415277913583905
obytes64117394244879432002380
opackets64125524921982908
rbytes648846879658431229742894

다음은 -A 와 -C옵션을 사용하여 지정한 이름에 대해서만 데이블을 만든다.

#  ls -l
dbserv    mailserv  webserv
# grep . dbserv mailserv webserv > out
# jtab -A dbserv,mailserv -C ce0,ce1 -u -d : -G 4,5,6 -a 1 -N host -n interface out > out6.html
다음은 out6.html 파일의 내용이다:
dbserv
interface ce0ce1
ipackets6410244172527
obytes642411739426244879
opackets6411125584249
rbytes64148846879296584
mailserv
ipackets641023883930
obytes64238900229879
opackets649393084849
rbytes64593930384958

다음은 jtab 명령어의 옵션이다.

옵션설명
-a fn -G 옵션에는 3개의 필드 번호를 지정하여 하나의 테이블을 만든다. 이것이 하나의 단위 테이블이다.
-a 옵션을 지정하면 이러한 단위 테이블을 포함하는 한 단계 큰 테이블을 만들 수 있게 한다.

-A names -A 옵션은 -a 옵션으로 추가로 선택된 필드에서 지정한 필드명만 선택되도록 한다.
-c bgcolor -c 옵션은 컬럼명과 열명에 대한 배경색을 지정한다.
-d del -d 옵션은 필드 구분자를 지정한다. 디폴트는 whitespace 이다.
-C names -C 옵션은 지정한 필드명만 컬럼명으로 선택되도록 한다.
-G fn1,fn2.fn3 -G 옵션에 3개의 필드 번호를 지정하는데, 첫번째 필드는 컬럼명으로 사용될 필드 번호이고, 두번째 필드는 열명으로 사용될 필드 번호이고, 세번째 필드는 데이타로 사용될 필드 번호이다.
-h -h 옵션을 -a 옵션과 함께 사용하면 단위 테이블마다 컬럼명을 매번 표시한다.
-n subtitle -n 옵션을 지정하면 왼쪽 상단에 소제목을 지정할 수 있다. 디폴트는 "+" 이다.
-N subtitle -N 옵션을 -a 옵션과 함께 사용하면 제일 왼쪽 상단에 소제목을 지정할 수 있다. 디폴트는 "*" 이다.
-P -P 옵션을 지정하면 HTML 형식이 아닌 테이블이 아닌 텍스트로 출력한다.
-R names -R 옵션은 지정한 필드명만 열명(row name)으로 선택되도록 한다.
-s -s 옵션을 지정하면 데이타가 없는 열은 출력하지 않는다.
-R 옵션을 사용하여 특정값을 지정했는데, 그것에 대한 값이 없는 경우 대쉬(-)로 표시된다. 이 경우에 -s 옵션을 지정하면, 그 값을 표시하지 않는다.

# jtab -R ce3,ce4 -P -d : -G 4,3,5 output > out7.html
+ ipackets64obytes64opackets64rbytes64
ce30000
ce4----
# jtab -s -R ce3,ce4 -P -d : -G 4,3,5 output > out7.html
+ ipackets64obytes64opackets64rbytes64
ce30000

-S skiplist file속에 있는 내용 중에 데이타가 아닌 라인이 있을 경우 -S 옵션을 사용하여 그 라인의 첫번째 컬럼에 있는 단어를 지정하여 스킵할 수 있다. 여러 단어일 경우 콤마(,)로 구분한다. 단어를 지정할 때, 단어 전체를 완전히 지정해도 되고 첫부분에 시작하는 몇 개의 문자만 지정해도 된다.
-T -T 옵션을 지정하면 HTML의 테그 중에 TABLE 만 출력한다.
-t title -t title 옵션을 지정하면 제목을 지정할 수 있다. HTML 형식일 경우, 웹 페이지의 TITLE 테그에도 지정된다.
-u -u 옵션을 -a 옵션과 함께 사용하면, 추가된 필드명이 단위 데이블의 상단에 표시된다.
-V -V 옵션을 지정하면, 명령어의 버전 정보를 보여준다.