Ray
Ray

Reputation: 6105

linux column command or other -- want some padding before output

I'm using the linux column command in a bash v4 script to put out data in columnar format which I need.

I don't want to specify a width of the first column of the data, because I don't know how long it will be, so I want the column command to just figure it out appropriately.

However to fit in with my other output from the script, I would like there to be some leading spaces before each line in the output. How do I add leading space? Right now I've simply got:

  echo -ne $output | column -t

Upvotes: 0

Views: 331

Answers (1)

Jonathan Leffler
Jonathan Leffler

Reputation: 753785

One option might be to pipe the output of column -t to

sed 's/^/    /'

to add four spaces — you get to choose how many you want, of course.

Upvotes: 1

Related Questions