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!

Help align data

Status
Not open for further replies.

cakecop

Technical User
Feb 21, 2002
20
0
0
US
Hi

I wrote a script to retreive a list of UID, User Name and info.
The problem is the collums are not aligned. If the User name is less then 11 characeters then the next collumn is
not lined up to names with 12+ characters.

#!/bin/ksh
cat /etc/passwd > /tmp/build0
sort -t: +2 /tmp/build0 > /tmp/build1

grep -v root /tmp/build1 > /tmp/build2
grep -v datatel /tmp/build2 > /tmp/build3
grep -v wordmarc /tmp/build3 > /tmp/build4
grep -v artsmart /tmp/build4 > /tmp/build5
grep -v udmsmgr /tmp/build5 > /tmp/build6
grep -v :bin: /tmp/build6 > /tmp/build7
grep -v lp /tmp/build7 > /tmp/build8
grep -v uucp /tmp/build8 > /tmp/build9
grep -v > /tmp/build10
grep -v nobody /tmp/build10 > /tmp/build11
grep -v adm /tmp/build11 > /tmp/build12
grep -v sys /tmp/build12 > /tmp/build13
grep -v hpdb /tmp/build13 > /tmp/build14

awk -F: '{print $3, $5}' /tmp/build14 > /tmp/build15

sed 's/,/ /g' /tmp/build15 > /tmp/build16
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top