home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / unix / shell / 5502 < prev    next >
Encoding:
Internet Message Format  |  1993-01-27  |  1.1 KB

  1. 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
  2. From: ndl@unix.brighton.ac.uk (Nathan Lock)
  3. Newsgroups: comp.unix.shell
  4. Subject: padding things out
  5. Message-ID: <1993Jan26.194057.1884@unix.brighton.ac.uk>
  6. Date: 26 Jan 93 19:40:57 GMT
  7. Organization: University of Brighton, UK
  8. Lines: 27
  9.  
  10. How can I take a variable length field 
  11. (e.g the gecos field in the password file)
  12. and pad it out in a shell script so that it is always the same length 
  13. for the next field to line up. 
  14. (with a tab I will not always get the same column, sometimes I need 1,
  15. other times 2 for a shortname) how can I determine whether I need 1 or 2 
  16. in a shell script?
  17.  
  18. e.g a single tab
  19.  
  20. Fred Bloggs     next field
  21. Joe Smith    next field
  22. Samantha Smith-jones    next field
  23. Sam Wheeler    next field
  24.  
  25. what I want to achieve:-
  26.  
  27. Fred Bloggs        next field
  28. Joe Smith        next field
  29. Samantha Smith-Jones    next field
  30. Sam Wheeler        next field
  31.  
  32. Standard shell or awk solutions please as I do not have perl etc.
  33.  
  34. Awaiting you reply
  35.  
  36. Nathan Lock.
  37.