home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.unix.shell
- 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
- From: sasmob@chewy.unx.sas.com (Mark Burhans)
- Subject: Re: Shell script poser
- Originator: sasmob@chewy.unx.sas.com
- Sender: news@unx.sas.com (Noter of Newsworthy Events)
- Message-ID: <BzDLzr.9qB@unx.sas.com>
- Date: Wed, 16 Dec 1992 23:45:27 GMT
- References: <724029721snx@trmphrst.demon.co.uk> <1992Dec14.150045.11456@maths.nott.ac.uk>
- Nntp-Posting-Host: chewy.unx.sas.com
- Organization: SAS Institute Inc.
- Lines: 33
-
-
- In article <1992Dec14.150045.11456@maths.nott.ac.uk>, anw@maths.nott.ac.uk (Dr A. N. Walker) writes:
- |> In article <724029721snx@trmphrst.demon.co.uk>
- |> nikki@trmphrst.demon.co.uk writes:
- |> >Here's a little shell-script problem for all you gurus out there ...
- |> [wants lines lower-cased and Capitalised]
- |> >Can this be done using STANDARD UNIX COMMANDS ONLY (i.e. awk, tr, sed etc.)
- |>
- |> It's easy enough with "sed":
- |>
- |> sed "
- |> y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/
- |> /^[a-z]/ { h
- |> y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/
- |> G
- |> s/\(.\).*\n./\1/
- |> }
- |> " < filename
-
- And it's easy enough with "awk":
-
- awk '{
- printf "%c%s\n", toupper(substr($0,1,1)),tolower(substr($0,2))
- }' <filename
-
-
- Just thought I'd do a different one...
-
-
- --
- ---Mark C. Burhans---sasmob@chewy.unx.sas.com---919/677-8001 ext 7324
- SAS Institute, Inc., USA, SAS Campus Drive, Cary, NC 27513.
- "Polygamy: One wife too many. Monogamy: Same idea." --Unknown???
-