home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!news.univie.ac.at!scsing.switch.ch!univ-lyon1.fr!ghost.dsi.unimi.it!rpi!uwm.edu!spool.mu.edu!agate!doc.ic.ac.uk!uknet!glasgow!unix.brighton.ac.uk!ndl
- From: ndl@unix.brighton.ac.uk (Nathan Lock)
- Newsgroups: comp.unix.shell
- Subject: padding things out
- Message-ID: <1993Jan26.194057.1884@unix.brighton.ac.uk>
- Date: 26 Jan 93 19:40:57 GMT
- Organization: University of Brighton, UK
- Lines: 27
-
- How can I take a variable length field
- (e.g the gecos field in the password file)
- and pad it out in a shell script so that it is always the same length
- for the next field to line up.
- (with a tab I will not always get the same column, sometimes I need 1,
- other times 2 for a shortname) how can I determine whether I need 1 or 2
- in a shell script?
-
- e.g a single tab
-
- Fred Bloggs next field
- Joe Smith next field
- Samantha Smith-jones next field
- Sam Wheeler next field
-
- what I want to achieve:-
-
- Fred Bloggs next field
- Joe Smith next field
- Samantha Smith-Jones next field
- Sam Wheeler next field
-
- Standard shell or awk solutions please as I do not have perl etc.
-
- Awaiting you reply
-
- Nathan Lock.
-