brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: column -t lines up messy output in tidy columns

Text processing
~/tips/column-t

mount | column -t

Aligns the output of any command, or a CSV file, into readable columns.

Some commands print values separated by single spaces or commas, and the result is hard to read. Piping it through column fixes that.

mount | column -t
column -t -s, data.csv

-t builds a table from the input and pads each column to the same width. With -s, you tell it that the separator is a comma, which makes a quick look at a CSV file readable without opening a spreadsheet.

Caveat: column reads the whole input before it prints, so it does not suit a stream that never ends. A comma inside a quoted CSV field also counts as a separator.

Further reading: column(1)

More Text processing tips xmlstarlet ed -u '//item[@id="1"]/title' -v 'Changed' feed.xml xmlstarlet sel -t -v '//item/title' -n feed.xml rg 'apiKey' -g '!*.min.js' -g '!package-lock.json' sed -n '$=' access.log jq -r '.files[] | @sh' data.json All Text processing tips (85) All topics

Link