lowercase to uppercase with sed

I know you're not supposed to ask homework questions, but this is driving me crazy.  I have a file named cars.txt which contains make|model|year|milage|price.  The question is to list all lines, but capitalize the first letter of the make using only one sed command. (ford would be Ford).  This is what I have so far:  sed 's/^[a-z]/What Goes here??/' cars.txt
I can't figure out what I should put as the replacement string.  I have tried everything I can think of which leads me to believe that my mind has gone to mush and it is something really easy.  Please help!
sdickensAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
tel2Connect With a Mentor Commented:
I can't figure it out either sdickens.

I know this is not a very elegant answer, but does this count as one sed command?
  sed "s/a/A/g;s/b/B/g;s/c/C/g;
  ...etc...
  ;s/z/Z/g" cars.txt

It would have been easy in tr:
  tr "[a-z]" "[A-Z]" <cats.txt
0
 
ahoffmannCommented:
tel2, both your examples replace *all* lower case letters.
sdickens, you need to use awk or perl. Using sed and tr can be done in a single line, but not a single command.
0
 
ahoffmannCommented:
opps, probably possible with sed, see b, t and y commands
0
 
tel2Commented:
GOOD POINT ahoffmann!
I must learn to read some day!

I guess I have to ammend my answer to:

sed "s/^a/A/;s/^b/B/;...etc...;s/^z/Z/"

If you can call that ONE command.

Please let us know when you find the REAL answer sdickens!
0
 
MoondancerCommented:
This question was awarded, but never cleared due to the JSP-500 errors of that time.  It was "stuck" against userID -1 versus the intended expert whom you awarded.  This corrects the problem and the expert will now receive these points; points verified.

Please click on your Member Profile and select "View Question History" to navigate through any open or locked questions you may have to update and finalize them.  Or if you are an EE Pro user, click the link below to select open items for your Member ID using Power Search:
http://www.experts-exchange.com/jsp/qPowerSearch.jsp.

This is the Community Support link, if help is needed, along with the link to All Topics which reflects many TAs recently added.

http://www.experts-exchange.com/jsp/qList.jsp?ta=commspt
http://www.experts-exchange.com/jsp/zonesAll.jsp
 
Thank you,
Moondancer
Moderator @ Experts Exchange
0
All Courses

From novice to tech pro — start learning today.