home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / unix / shell / 5094 < prev    next >
Encoding:
Text File  |  1992-12-16  |  1.6 KB  |  47 lines

  1. Newsgroups: comp.unix.shell
  2. Path: sparky!uunet!zaphod.mps.ohio-state.edu!magnus.acs.ohio-state.edu!usenet.ins.cwru.edu!agate!stanford.edu!rock!concert!sas!mozart.unx.sas.com!sasmob
  3. From: sasmob@chewy.unx.sas.com (Mark Burhans)
  4. Subject: Re: Shell script poser
  5. Originator: sasmob@chewy.unx.sas.com
  6. Sender: news@unx.sas.com (Noter of Newsworthy Events)
  7. Message-ID: <BzDLzr.9qB@unx.sas.com>
  8. Date: Wed, 16 Dec 1992 23:45:27 GMT
  9. References: <724029721snx@trmphrst.demon.co.uk> <1992Dec14.150045.11456@maths.nott.ac.uk>
  10. Nntp-Posting-Host: chewy.unx.sas.com
  11. Organization: SAS Institute Inc.
  12. Lines: 33
  13.  
  14.  
  15. In article <1992Dec14.150045.11456@maths.nott.ac.uk>, anw@maths.nott.ac.uk (Dr A. N. Walker) writes:
  16. |> In article <724029721snx@trmphrst.demon.co.uk>
  17. |> nikki@trmphrst.demon.co.uk writes:
  18. |> >Here's a little shell-script problem for all you gurus out there ...
  19. |>     [wants lines lower-cased and Capitalised]
  20. |> >Can this be done using STANDARD UNIX COMMANDS ONLY (i.e. awk, tr, sed etc.)
  21. |> 
  22. |>     It's easy enough with "sed":
  23. |> 
  24. |> sed "
  25. |>     y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/
  26. |>     /^[a-z]/ { h
  27. |>            y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/
  28. |>            G
  29. |>            s/\(.\).*\n./\1/
  30. |>          }
  31. |> " < filename
  32.  
  33. And it's easy enough with "awk":
  34.  
  35. awk '{
  36.         printf "%c%s\n", toupper(substr($0,1,1)),tolower(substr($0,2))
  37.      }' <filename
  38.  
  39.  
  40. Just thought I'd do a different one...
  41.  
  42.  
  43. -- 
  44. ---Mark C. Burhans---sasmob@chewy.unx.sas.com---919/677-8001 ext 7324
  45. SAS Institute, Inc., USA, SAS Campus Drive, Cary, NC 27513.
  46. "Polygamy:  One wife too many.  Monogamy:  Same idea."  --Unknown???
  47.