Change case of string to "Title case" (Kate name for it).
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Change case of string to "Title case" (Kate name for it).
I'm looking for a way to change the case of every first letter of a string with more than one word in it, such as
parlour car
to
Parlour Car.
I prefer, for my own reasons (a clue to one of which is in two lines of my signature), to do so on the command line rather than in\with Kate or Notepadqq.
Is there a simple way, in bash or perl, to accomplish this?
I'm looking for a way to change the case of every first letter of a string with more than one word in it, such as
parlour car
to
Parlour Car.
I prefer, for my own reasons (a clue to one of which is in two lines of my signature), to do so on the command line rather than in\with Kate or Notepadqq.
Is there a simple way, in bash or perl, to accomplish this?
There is at least one Linux shell command which can change case, and there are a number of commands which can replace characters, thereby also changing case. Have look at the tr command, however I believe awk and sed can obviously edit files as well. I also feel it depends whether you wish to do this using Perl or a bash script. I'm guessing you can call Linux commands using Perl much like you can do this using a bash script.
It would be helpful to know if you have yet tried anything, or at the very least, to know whether you're more comfortable with bash or Perl.
The OP only wanted to change the first letter - I learnt a long ime ago not to munge the users data beyond what they asked for.
Whether it was sensible was a cause perhaps for a query, but I did what I was asked for. That way other arses got kicked, not mine.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.