2022-10-04 16:12:12 +02:00
|
|
|
[](https://github.com/tlinden/tablizer/actions)
|
2022-10-04 16:05:02 +02:00
|
|
|
[](https://github.com/tlinden/tablizer/blob/master/LICENSE)
|
2022-10-14 19:51:19 +02:00
|
|
|
[](https://goreportcard.com/report/github.com/tlinden/tablizer)
|
2022-09-30 19:52:16 +02:00
|
|
|
|
2022-09-28 19:30:08 +02:00
|
|
|
## tablizer - Manipulate tabular output of other programs
|
|
|
|
|
|
|
|
|
|
Tablizer can be used to re-format tabular output of other
|
|
|
|
|
programs. While you could do this using standard unix tools, in some
|
|
|
|
|
cases it's a hard job.
|
|
|
|
|
|
|
|
|
|
Let's take this output:
|
|
|
|
|
```
|
|
|
|
|
% kubectl get pods -o wide
|
|
|
|
|
NAME READY STATUS RESTARTS AGE
|
|
|
|
|
repldepl-7bcd8d5b64-7zq4l 1/1 Running 1 (69m ago) 5h26m
|
|
|
|
|
repldepl-7bcd8d5b64-m48n8 1/1 Running 1 (69m ago) 5h26m
|
|
|
|
|
repldepl-7bcd8d5b64-q2bf4 1/1 Running 1 (69m ago) 5h26m
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
But you're only interested in the NAME and STATUS columns. Here's how
|
|
|
|
|
to do this with tablizer:
|
|
|
|
|
|
|
|
|
|
```
|
2022-10-11 18:50:58 +02:00
|
|
|
% kubectl get pods | tablizer
|
2022-09-28 19:30:08 +02:00
|
|
|
NAME(1) READY(2) STATUS(3) RESTARTS(4) AGE(5)
|
|
|
|
|
repldepl-7bcd8d5b64-7zq4l 1/1 Running 1 (69m ago) 5h26m
|
|
|
|
|
repldepl-7bcd8d5b64-m48n8 1/1 Running 1 (69m ago) 5h26m
|
|
|
|
|
repldepl-7bcd8d5b64-q2bf4 1/1 Running 1 (69m ago) 5h26m
|
|
|
|
|
|
2022-10-11 18:50:58 +02:00
|
|
|
% kubectl get pods | tablizer -c 1,3
|
2022-09-28 19:30:08 +02:00
|
|
|
NAME(1) STATUS(3)
|
|
|
|
|
repldepl-7bcd8d5b64-7zq4l Running
|
|
|
|
|
repldepl-7bcd8d5b64-m48n8 Running
|
|
|
|
|
repldepl-7bcd8d5b64-q2bf4 Running
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Another use case is when the tabular output is so wide that lines are
|
2022-10-11 18:50:58 +02:00
|
|
|
being broken and the whole output is completely distorted. In such a
|
|
|
|
|
case you can use the `-o extended | -X` flag to get an output similar
|
|
|
|
|
to `\x` in `psql`:
|
2022-09-28 19:30:08 +02:00
|
|
|
|
|
|
|
|
```
|
2022-10-11 18:50:58 +02:00
|
|
|
% kubectl get pods | tablizer -X
|
|
|
|
|
NAME: repldepl-7bcd8d5b64-7zq4l
|
|
|
|
|
READY: 1/1
|
|
|
|
|
STATUS: Running
|
|
|
|
|
RESTARTS: 1 (71m ago)
|
2022-09-28 19:30:08 +02:00
|
|
|
AGE: 5h28m
|
|
|
|
|
|
2022-10-11 18:50:58 +02:00
|
|
|
NAME: repldepl-7bcd8d5b64-m48n8
|
|
|
|
|
READY: 1/1
|
|
|
|
|
STATUS: Running
|
|
|
|
|
RESTARTS: 1 (71m ago)
|
2022-09-28 19:30:08 +02:00
|
|
|
AGE: 5h28m
|
|
|
|
|
|
2022-10-11 18:50:58 +02:00
|
|
|
NAME: repldepl-7bcd8d5b64-q2bf4
|
|
|
|
|
READY: 1/1
|
|
|
|
|
STATUS: Running
|
|
|
|
|
RESTARTS: 1 (71m ago)
|
2022-09-28 19:30:08 +02:00
|
|
|
AGE: 5h28m
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Tablize can read one or more files or - if none specified - from STDIN.
|
|
|
|
|
|
|
|
|
|
You can also specify a regex pattern to reduce the output:
|
|
|
|
|
|
|
|
|
|
```
|
2022-10-11 18:50:58 +02:00
|
|
|
% kubectl get pods | tablizer q2bf4
|
2022-09-28 19:30:08 +02:00
|
|
|
NAME(1) READY(2) STATUS(3) RESTARTS(4) AGE(5)
|
|
|
|
|
repldepl-7bcd8d5b64-q2bf4 1/1 Running 1 (69m ago) 5h26m
|
|
|
|
|
```
|
|
|
|
|
|
2024-05-07 18:00:57 +02:00
|
|
|
Sometimes a filter regex is to broad and you wish to filter only on a
|
|
|
|
|
particular column. This is possible using `-F`:
|
|
|
|
|
```
|
|
|
|
|
% kubectl get pods | tablizer -n -Fname=2
|
|
|
|
|
NAME READY STATUS RESTARTS AGE
|
|
|
|
|
repldepl-7bcd8d5b64-q2bf4 1/1 Running 1 (69m ago) 5h26m
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Here we filtered the `NAME` column for `2`, which would have matched
|
|
|
|
|
otherwise on all rows.
|
|
|
|
|
|
2022-10-11 18:50:58 +02:00
|
|
|
There are more output modes like org-mode (orgtbl) and markdown.
|
2022-09-28 19:30:08 +02:00
|
|
|
|
2025-01-10 18:26:33 +01:00
|
|
|
Last but not least tablizer has support for plugins written in
|
|
|
|
|
lisp. This feature is expermental yet. Take a look into the manpage
|
|
|
|
|
for details.
|
|
|
|
|
|
2022-10-27 19:22:36 +02:00
|
|
|
## Demo
|
|
|
|
|
|
2022-11-03 13:11:09 +01:00
|
|
|
[](https://asciinema.org/a/9FKc3HPnlg8D2X8otheleEa9t)
|
2022-10-27 19:22:36 +02:00
|
|
|
|
2022-09-28 19:30:08 +02:00
|
|
|
## Installation
|
|
|
|
|
|
2022-09-29 16:50:36 +02:00
|
|
|
There are multiple ways to install **tablizer**:
|
|
|
|
|
|
2022-10-26 12:38:08 +02:00
|
|
|
- Go to the [latest release page](https://github.com/tlinden/tablizer/releases/latest),
|
2022-09-29 16:50:36 +02:00
|
|
|
locate the binary for your operating system and platform.
|
|
|
|
|
|
|
|
|
|
Download it and put it into some directory within your `$PATH` variable.
|
|
|
|
|
|
2022-09-29 18:13:53 +02:00
|
|
|
- The release page also contains a tarball for every supported platform. Unpack it
|
|
|
|
|
to some temporary directory, extract it and execute the following command inside:
|
|
|
|
|
```
|
|
|
|
|
sudo make install
|
|
|
|
|
```
|
|
|
|
|
|
2022-09-29 16:50:36 +02:00
|
|
|
- You can also install from source. Issue the following commands in your shell:
|
|
|
|
|
```
|
|
|
|
|
git clone https://github.com/TLINDEN/tablizer.git
|
|
|
|
|
cd tablizer
|
|
|
|
|
make
|
|
|
|
|
sudo make install
|
|
|
|
|
```
|
|
|
|
|
|
2022-09-29 18:13:53 +02:00
|
|
|
If you do not find a binary release for your platform, please don't
|
|
|
|
|
hesitate to ask me about it, I'll add it.
|
|
|
|
|
|
2022-09-29 16:50:36 +02:00
|
|
|
## Documentation
|
|
|
|
|
|
|
|
|
|
The documentation is provided as a unix man-page. It will be
|
|
|
|
|
automatically installed if you install from source. However, you can
|
|
|
|
|
read the man-page online:
|
|
|
|
|
|
2022-09-29 16:53:21 +02:00
|
|
|
https://github.com/TLINDEN/tablizer/blob/main/tablizer.pod
|
2022-09-29 16:50:36 +02:00
|
|
|
|
|
|
|
|
Or if you cloned the repository you can read it this way (perl needs
|
|
|
|
|
to be installed though): `perldoc tablizer.pod`.
|
|
|
|
|
|
2022-10-11 18:50:58 +02:00
|
|
|
If you have the binary installed, you can also read the man page with
|
|
|
|
|
this command:
|
|
|
|
|
|
|
|
|
|
tablizer --man
|
2022-09-28 19:30:08 +02:00
|
|
|
|
|
|
|
|
## Getting help
|
|
|
|
|
|
2022-09-29 06:04:45 +02:00
|
|
|
Although I'm happy to hear from tablizer users in private email,
|
2022-09-28 19:30:08 +02:00
|
|
|
that's the best way for me to forget to do something.
|
|
|
|
|
|
|
|
|
|
In order to report a bug, unexpected behavior, feature requests
|
|
|
|
|
or to submit a patch, please open an issue on github:
|
|
|
|
|
https://github.com/TLINDEN/tablizer/issues.
|
|
|
|
|
|
|
|
|
|
## Copyright and license
|
|
|
|
|
|
|
|
|
|
This software is licensed under the GNU GENERAL PUBLIC LICENSE version 3.
|
|
|
|
|
|
|
|
|
|
## Authors
|
|
|
|
|
|
|
|
|
|
T.v.Dein <tom AT vondein DOT org>
|
|
|
|
|
|
|
|
|
|
## Project homepage
|
|
|
|
|
|
|
|
|
|
https://github.com/TLINDEN/tablizer
|