Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to set tabs size?

Status
Not open for further replies.

sjsp

Technical User
Aug 24, 2001
14
GB
Hi,

I am writing a script to run 'df -k' on remote machines and redirecting the output to a file.

This works fine but the problem I have it that as the tab length is 8 characters, anything larger than 8 chars is shifted right. Is there anything I can do to rectify this?

An extract/example from the scripts is as follows:

remsh $host df -lk | awk '{print $2 "\t\t" $3 "\t\t" $4 "\t\t" $5 "\t\t" $6}'> disk-usage-from-$host

I.E the columns dispalyed are:

kbytes used avail capacity Mounted

If the result outputs that the kbytes is greater that 8 chars the rest of the line shifts to the right and the columns do not appear in alignment with the smaller filesystems.

I have has a look at the tabs command etc
 
An alternative solution would be to use printf instead of print in your awk command. This would allow you to format the output as you like.

Greg.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top