LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 04-13-2005, 07:23 PM   #1
lowpro2k3
Member
 
Registered: Oct 2003
Location: Canada
Distribution: Slackware
Posts: 340

Rep: Reputation: 30
Converting sLoPPy cASE to Pretty Case with tr


I need a quick one-liner for an assignment to convert strings of any type (including uGLY sTuFF lIKE thiS) into strings like these (Doesnt This Look A Lot Nicer?)

I also have to convert AnY CasE to UPPER CASE, but that one was easy (echo str | tr [:lower:] [:upper:]) but I can't figure out how to get the first character to convert and not the whole string. I could do some substringing, but dont really want to if I dont have to (btw this is in bash...)
 
Old 04-13-2005, 07:47 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 22,978
Blog Entries: 11

Rep: Reputation: 879Reputation: 879Reputation: 879Reputation: 879Reputation: 879Reputation: 879Reputation: 879
Since it's an assignment question I suggest you research
the possibilities using google and experiments ...

Asking Homework questions is against the RULES


Cheers,
Tink
 
Old 04-13-2005, 08:05 PM   #3
lowpro2k3
Member
 
Registered: Oct 2003
Location: Canada
Distribution: Slackware
Posts: 340

Original Poster
Rep: Reputation: 30
Its a huge assignment, I'm asking for literally 1/3 of a one-liner. I have my textbook out and I've searched google like 19 times. Its pretty trivial for anyone who knows how to do it. I'm just not a fan of wasting insane amounts of time on a something trivial like this while I have other assignments in assembly, c++ and web programming. I fully understand the reason for the rules, but if I didnt mutter the words 'for my assignment' nobody would have known and I would have got the answer. At least i'm being honest. If it was for a project at work would that be OK? Please explain the difference. I understand "its for my own good" and all that, but I need to finish MANY assignments in the next 2 days so I can GO HOME and see my family instead of wasting time fidgeting with tr in Linux.

Code:
echo "str" | tr [:upper:] [:lower:] | MY QUESTION
At least I didnt post my entire assignment and ask you guys to write the code like 90% of the school questions on this forum. I'm stressed out, its exam time, I desperately want to finish my multiple remaining assignments so I can drive home this weekend and see my family and friends, I AM on google with my textbook in front of me and I caught a glimmer of hope opening this thread thinking someone answered my question. I dont mean to sound like an a-hole but I'm very stressed and I can barely think straight enough. This question about my assignment is less than a line out of hundreds, spanning 2 (g)awk scripts and a large bash script. Not the biggest program ever, but believe me I've done my fair share of my own code with the textbook and google.

Thanks for understanding.

BTW I still haven't got it yet and would still appreciate an answer. My head is spinning from lack of cigarettes (quit last week) and too much programming. Please understand. Thanks.

Last edited by lowpro2k3; 04-13-2005 at 08:11 PM.
 
Old 04-13-2005, 08:08 PM   #4
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 22,978
Blog Entries: 11

Rep: Reputation: 879Reputation: 879Reputation: 879Reputation: 879Reputation: 879Reputation: 879Reputation: 879
C'mon kiddo, don't get lippy with me. You've signed up and
agreed to the rules, and that's the end of the discussion.


Cheers,
Tink
 
Old 04-13-2005, 08:13 PM   #5
lowpro2k3
Member
 
Registered: Oct 2003
Location: Canada
Distribution: Slackware
Posts: 340

Original Poster
Rep: Reputation: 30
fine

Last edited by lowpro2k3; 04-13-2005 at 08:21 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Change Case DavidPhillips Programming 6 04-02-2005 04:45 PM
Why are all my upper case files being shown as lower case?? [Kernel 2.6.9-1.667 FC3] t3gah Fedora 4 03-11-2005 04:09 PM
Lower case to upper case letter sudhasmyle Programming 1 12-03-2004 04:15 AM
Case Iain Wilson Linux - Newbie 1 03-16-2004 11:51 PM
Skyhawk Case cjorli Linux - General 0 10-14-2002 10:57 PM


All times are GMT -5. The time now is 03:34 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration