Path: utzoo!attcan!uunet!seismo!dimacs.rutgers.edu!mips!zaphod.mps.ohio-state.edu!swrinde!dfsun1!jackson From: jackson@dfsun1.electro.swri.edu (Keith Jackson) Newsgroups: comp.unix.questions Subject: Re: Selective translation Message-ID: <1558@dfsun1.electro.swri.edu> Date: 11 Jul 90 14:33:26 GMT Reply-To: jackson@dfsun1.electro.swri.edu (Keith Jackson) Organization: Southwest Research Institute, San Antonio, Texas Lines: 44 ) In article <8677@jpl-devvax.JPL.NASA.GOV> lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) ) In article <1553@dfsun1.electro.swri.edu> jackson@dfsun1.electro.swri.edu (Keith Jackson) writes: ) : I was trying to filter a file by making the first word lowercase and ) : leaving the rest as is. My solution: ) : ) : (cumbersome process deleted) ) ) Well, there's ) ) (many perl solutions deleted (gee, I thought she just sang ;^)) ) ) or even ) ) sed -e 'h' \ ) -e 's/^\([ ]*[^ ][^ ]*\).*/\1/' \ ) -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/' \ ) -e 'G' \ ) -e 's/\n[ ]*[^ ][^ ]*//' foo >final ) ) where [ ] and [^ ] can be expanded to have a tab as well. ) ) Take your pick. All of these will preserve the whitespace around the ) first word on each line, which you can't do very easily with awk. ) ) Larry Wall ) lwall@jpl-devvax.jpl.nasa.gov This sed solution seems to be the only one I've seen to keep whitespace intact. Another solution for those who don't care about spacing: #! /bin/sh while {read ab} do { echo -n $a\# | tr A-Z a-z; echo $b; } Where # is whatever character you want to separate the two. -- ######## U N * X : L i v e F r e e o r D i e ######## Keith Jackson {convex, texsun}!smu!jackson == jackson@csvax.seas.smu.edu == jackson@dfsun1.electro.swri.edu Disclaimer: They're not paying me for my opinons. I'd starve.