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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Formatting Console Output 1

Status
Not open for further replies.

jtanner

Technical User
Feb 18, 2007
39
0
0
US
Hello,

In a Bourne shell script I have some variables ($SYSTEM, $STATUS, $CONNECTIONS,$STARTUP_TIME etc.) that I want to print to the console output in a symetrical way. I want the values to line up with the column headers.

Code:
System Status  Connections Startup
-------------------------------------
SYS01  OPEN    150\25      2007-06-22
SYS02  OPEN    150\102     2007-06-02
SYS03  MAINT   150\43      2007-05-14

My problem is that the values are not fixed length and thus do not always align. I tried using awk and entering a tab (by hand pressing the tab key for OFS) but this was kluugy.

Using Perl and other languages with stronger console output features is not an option.

What can you recommend?


Thanks,

JT
 
feherke,

That is simple and perfect. Thanks for posting. :)


JT
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top