diff --git a/README.md b/README.md index 3512d92..769b6c4 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ working across different projects via [VisualMode](https://www.visualmode.dev/). For a steady stream of TILs, [sign up for my newsletter](https://visualmode.kit.com/newsletter). -_1730 TILs and counting..._ +_1731 TILs and counting..._ See some of the other learning resources I work on: @@ -1675,6 +1675,7 @@ If you've learned something here, support my efforts writing daily TILs by - [Fix Previous Command With fc](unix/fix-previous-command-with-fc.md) - [Fix Shim Path After asdf Upgrade](unix/fix-shim-path-after-asdf-upgrade.md) - [Fix Unlinked Node Binaries With asdf](unix/fix-unlinked-node-binaries-with-asdf.md) +- [Format And Display Small Amounts Of Columnar Data](unix/format-and-display-small-amounts-of-columnar-data.md) - [Forward Multiple Ports Over SSH](unix/forward-multiple-ports-over-ssh.md) - [Generate A SAML Key And Certificate Pair](unix/generate-a-saml-key-and-certificate-pair.md) - [Generate A Sequence Of Numbered Items](unix/generate-a-sequence-of-numbered-items.md) diff --git a/unix/format-and-display-small-amounts-of-columnar-data.md b/unix/format-and-display-small-amounts-of-columnar-data.md new file mode 100644 index 0000000..da3b05c --- /dev/null +++ b/unix/format-and-display-small-amounts-of-columnar-data.md @@ -0,0 +1,44 @@ +# Format And Display Small Amounts Of Columnar Data + +In [_List Processes Running Across All (tmux) +Sessions](tmux/list-processes-running-across-all-sessions.md), I showed an +example of piping some data from `tmux` to the `column -t` command to nicely format +and display the columnar data as a table. By default is uses spaces as the +delimiter. + +```bash +❯ tmux list-panes -a -F "#{session_name}:#{window_index}.#{pane_index} #{pane_pid} #{pane_current_command}" \ + | column -t + +PLP:1.1 62364 zsh +TIL:1.1 62345 nvim +TIL:1.2 65838 task +TIL:2.1 11428 tmux +client-app:1.1 62373 ssh +client-app:1.2 10796 zsh +client-app:1.3 63081 zsh +client-app:2.1 61115 overmind +client-app:3.1 82608 zsh +visualmode-dev:1.1 52237 zsh +``` + +This can be useful for formatting data from all kinds of commands and tools. +Sometimes the columns of data are separated by something other than spaces. For +instance, here is some git branch information (for my [dotfiles +repo](https://github.com/jbranchaud/dotfiles)) separated by the `|` character. +To format that with `column`, I need to also include the `-s '|'` flag to +override the delimiter. + +```bash +❯ git for-each-ref --format='%(refname:short)|%(authordate:short)|%(authorname)' refs/heads/ \ + | column -t -s '|' + +claude/sync-dotfiles-011CUP87cRV6c51eEi3Chg99 2025-10-22 jbranchaud +jb/add-rhubarb-for-fugitive-github-browse 2025-11-02 jbranchaud +jb/fix-hardcoded-paths 2025-11-02 jbranchaud +jb/set-nvim-to-default-manpager 2025-10-19 jbranchaud +main 2026-01-10 jbranchaud +master 2025-10-30 Dorian Karter +my-dotfiles 2025-11-01 jbranchaud +upstream-master 2026-01-01 Dorian Karter +```