Quantcast
Channel: UNIX and Linux Forums
Viewing all articles
Browse latest Browse all 16232

How to allign output data in UNIX that is separated with a pipe "|" symbol ?

$
0
0
Experts ,
In the given output of the log file, the 2nd field that is separated by "|" pipe is not aligned well due to the uneven data length, I would like it to align the 2nd column with 37 length (that is disturbed in the output) including the pipe . The two pepe "|" would be in a aligned way with length 37 , so it would look better.

Please advise how to align the output ,



Code:

# cat logfile


zmihx88  |    ia64 hp Integrity BL890c i8  |          B.11.23 |        4:84pm  up  99:94,  8 
umihx70  |    ia64 hp server BL870c  |                B.11.23 |        4:84pm  up  98:08,  0
zmihx79  |    ia64 hp server BL870c  |                B.11.23 |        4:84pm  up  98:09,  0 
zmihx78  |    9000/800/rp8440    |                    B.11.23 |        4:84pm  up  8:76,  0
zmihx77  |    9000/800/rp8440  |                      B.11.23 |        4:84pm  up  98:86,  0 
wmihx95  |    9000/800/K520  |                        B.11.23 |        4:84pm  up  9:80,  0 
wmihx96  |    9000/800/rp8440  |                      B.11.23 |        4:84pm  up  7:59,  0
wmihx86  |    9000/800/S96K-A  |                      B.11.31 |        4:84pm  up  4:88,  0 
umihx87  |    9000/800/rp8440    |                    B.11.23 |        4:84pm  up  6:50,  0 
umihx82  |    9000/800/S96K-A  |                      B.11.23 |        4:84pm  up  97:87,  0




The output should be look like below:


Code:

          |<------  37  space --------------->|
                 
zmihx88    |    ia64 hp Integrity BL890c i8  |          B.11.23 |        4:84pm  up  99:94,  8 
umihx70    |    ia64 hp server BL870c        |          B.11.23 |        4:84pm  up  98:08,  0
zmihx79    |    ia64 hp server BL870c        |          B.11.23 |        4:84pm  up  98:09,  0 
zmihx78    |    9000/800/rp8440              |          B.11.23 |        4:84pm  up  8:76,  0
zmihx77    |    9000/800/rp8440              |          B.11.23 |        4:84pm  up  98:86,  0 
wmihx95    |    9000/800/K520                |          B.11.23 |        4:84pm  up  9:80,  0 
wmihx96    |    9000/800/rp8440              |          B.11.23 |        4:84pm  up  7:59,  0
wmihx86    |    9000/800/S96K-A              |          B.11.31 |        4:84pm  up  4:88,  0 
umihx87    |    9000/800/rp8440              |          B.11.23 |        4:84pm  up  6:50,  0 
umihx82    |    9000/800/S96K-A              |          B.11.23 |        4:84pm  up  97:87,  0



Thanks,

Viewing all articles
Browse latest Browse all 16232

Trending Articles