From 7afe6e33cd10f211accb89d6db117a8953bbb6f8 Mon Sep 17 00:00:00 2001 From: Malin Freeborn Date: Tue, 4 Feb 2025 19:33:13 +0100 Subject: [PATCH] basic column command --- basics/column.md | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 basics/column.md diff --git a/basics/column.md b/basics/column.md new file mode 100644 index 0000000..b855ef4 --- /dev/null +++ b/basics/column.md @@ -0,0 +1,36 @@ +--- +title: "column" +tags: [ "basics", "format", "json" ] +--- + +Put output into column. + +```bash +du -h /etc/* | column +``` + +Reformat file with an explicit separator (`-s`): + +```bash +column -ts: /etc/passwd +``` + +Give columns names (`-N`), so you can hide some (`-H`): + +```bash +column -ts: -N User,PW,UID,GID,Description,Home,shell -H PW,GID /etc/passwd +``` + +Reorder with `-O` (unspecified items remain): + + +```bash +column -ts: -N User,PW,UID,GID,Description,Home,shell -H PW,GID -O User,Description,shell /etc/passwd +``` + +Output to json format with `-J`: + +```bash +column -J -ts: -H PW,GID,shell -N User,PW,UID,GID,Description,Home,shell /etc/passwd +``` +