Re: Lower casing letters of words



Hello, Thanks for your response. Was this meant to go in a script? I
created a script

#!/bin/ksh

while read -C -a array; do
array[3]=`echo ${array[2]} | perl -pi -e 's/(\w+)/\u\L$1/g'
myfile.txt`
array[4]=`echo ${array[4]} | perl -pi -e 's/(\w+)/\u\L$1/g'
myfile.txt`
array[5]=`echo ${array[5]} | perl -pi -e 's/(\w+)/\u\L$1/g'
myfile.txt`
echo "${array[*]|,,}"
done

Then I ran

../temp.sh

but got the error

../temp.sh[3]: read: bad option(s)

What am I doing incorrectly? Thanks, - Dave

Paul Lalli wrote:
> Paul Lalli wrote:
> > laredotornado@xxxxxxxxxxx wrote:
> > > Hello,
> > > Is there a simple perl command line expression I can write that will
> > > take
> > >
> > > "CORDOVA SCHOOL DISTRICT"
> > >
> > > and make it
> > >
> > > "Cordova School District"
> >
> > s/(\w+)/\u\L$1/g;
>
> Bah. Should have checked the Perl FAQ before posting. Of course, so
> should the OP...
>
> perldoc -q capitalize
> shows that this solution is sub-optimal at best, and recommends a
> slightly longer alternative. I recommend you use the one suggested
> there.
>
> > Paul Lalli

.



Relevant Pages

  • Re: Lower casing letters of words
    ... Paul Lalli wrote: ... >> Is there a simple perl command line expression I can write that will ... shows that this solution is sub-optimal at best, and recommends a ... Prev by Date: ...
    (comp.lang.perl.misc)
  • Re: Sum the middle column for a given unique volser.
    ... Paul Lalli wrote: ... That's because your method of posting and asking ... questions has been at least equally rude. ... post a SHORT but COMPLETE script that demonstrates your error. ...
    (comp.lang.perl.misc)
  • Re: I need a host.
    ... >> Paul Lalli wrote: ... >> IF they allow clients to view error logs they do not provide ... >> I added these lines to no avail so I desided to add them to a script I ... > just printing the names of the colors, ...
    (perl.beginners)
  • Re: Installing Curses Module?
    ... Changing the constructor removed the error message, ... The Perl command line interpreter was running, ... Generally an IDE captures the output of your script, ... memory and after that it writes in the console ...
    (comp.lang.perl.modules)
  • Re: error logs...
    ... >>Paul Lalli ... That CGI::Carp line is how you have perl display for you the error ... messages to the browser. ... if you were running the script just on the command line. ...
    (comp.lang.perl.misc)