[LAD] [ot] capitalising words in a shell-script

2008-09-26 Thread Julien Claassen
Hello there! Is there a nice and simple awk/sed trick to just capitalise a word? I didn't come up with one so far. I could do it by hand, it's a known set of words, but it would be nicer with a real word-independent mechanism. Kindest regards Julien Music was my first lo

Re: [LAD] [ot] capitalising words in a shell-script

2008-09-26 Thread Markus Schwarzenberg
On Fri, 26 Sep 2008 12:11:52 +0200 (CEST) Julien Claassen <[EMAIL PROTECTED]> wrote: > Hello there! >Is there a nice and simple awk/sed trick to just capitalise a word? I > didn't > come up with one so far. I could do it by hand, it's a known set of words, > but > it would be nicer with a

Re: [LAD] [ot] capitalising words in a shell-script

2008-09-26 Thread Steve Harris
Hi Julien, People usually use tr for that: $ echo foo | tr 'a-z' 'A-Z' FOO - Steve On 26 Sep 2008, at 11:11, Julien Claassen wrote: > Hello there! > Is there a nice and simple awk/sed trick to just capitalise a > word? I didn't > come up with one so far. I could do it by hand, it's a known

Re: [LAD] [ot] capitalising words in a shell-script

2008-09-26 Thread Paul Davis
On Fri, 2008-09-26 at 11:47 +0100, Steve Harris wrote: > Hi Julien, > > People usually use tr for that: > > $ echo foo | tr 'a-z' 'A-Z' > FOO i believe he meant capitalize as in "foo" -> "Foo" which is an order of magnitude harder. i don't believe that sed can do it. perl probably can. __

Re: [LAD] [ot] capitalising words in a shell-script

2008-09-26 Thread Chris Cannam
On Fri, Sep 26, 2008 at 11:53 AM, Paul Davis <[EMAIL PROTECTED]> wrote: > i believe he meant capitalize as in "foo" -> "Foo" which is an order of > magnitude harder. i don't believe that sed can do it. perl probably can. It can, e.g. $ echo hello | perl -pe 's/(.*)/\u$1\e/' Chris __

Re: [LAD] [ot] capitalising words in a shell-script

2008-09-26 Thread Chris Cannam
On Fri, Sep 26, 2008 at 11:56 AM, Chris Cannam <[EMAIL PROTECTED]> wrote: > $ echo hello | perl -pe 's/(.*)/\u$1\e/' I was forgetting there's also a function for this, you don't have to use the rather opaque substitution syntax: $ echo hello | perl -e 'print ucfirst <>' Chris __

Re: [LAD] [ot] capitalising words in a shell-script

2008-09-26 Thread Julien Claassen
Hi! Thank you all! I managed. there is something I didn't think of, which is, that you can output only part of shell-variables. Now it looks like this: VAR="Monday" tmp_first=`echo "${VAR:0:1}" | tr 'a-z' 'A-Z'` tmp_rest=`echo "${VAR:1}" tmp_rest_short=`echo "${VAR:1:2}"` var_long="$tmp_first$t

Re: [LAD] [ot] capitalising words in a shell-script

2008-09-26 Thread Wolfgang Woehl
Julien Claassen: > Hi! >Thank you all! I managed. there is something I didn't think of, > which is, that you can output only part of shell-variables. Now it > looks like this: VAR="Monday" > tmp_first=`echo "${VAR:0:1}" | tr 'a-z' 'A-Z'` > tmp_rest=`echo "${VAR:1}" > tmp_rest_short=`echo "${VAR

Re: [LAD] [ot] capitalising words in a shell-script

2008-09-26 Thread Jens M Andreasen
On Sat, 2008-09-27 at 00:03 +0200, Wolfgang Woehl wrote: > Oh my god :) > This one is ugly too but, while we're at it, what the hell: > echo "monday" | cut -b -3 | sed 's/\(^.\)/\U\1/' While you are at it, could you explain that last sentence once more for those in the audience that did not get it

Re: [LAD] [ot] capitalising words in a shell-script

2008-09-26 Thread Wolfgang Woehl
Jens M Andreasen: > On Sat, 2008-09-27 at 00:03 +0200, Wolfgang Woehl wrote: > > Oh my god :) > > This one is ugly too but, while we're at it, what the hell: > > echo "monday" | cut -b -3 | sed 's/\(^.\)/\U\1/' > > While you are at it, could you explain that last sentence once more > for those in t

Re: [LAD] [ot] capitalising words in a shell-script

2008-09-26 Thread Jens M Andreasen
Thankyou! > sed 's/\(^.\)/\U\1/' > > > ^. is the 1st char, put into () (protected with \) to store in \1 > which gets uppercased with \U. You never mentioned the forward slash in our tent camp. Is i it so that everybody else - that is important, knows the meaning of s/junk/gold ? _

Re: [LAD] [ot] capitalising words in a shell-script

2008-09-26 Thread Emanuel Rumpf
2008/9/27 Wolfgang Woehl <[EMAIL PROTECTED]>: > Oh my god :) > This one is ugly too but, while we're at it, what the hell: > echo "monday" | cut -b -3 | sed 's/\(^.\)/\U\1/' > python -c "d='monday'.capitalize(); print d[0:3]" ! :-) ___ Linux-audi

Re: [LAD] [ot] capitalising words in a shell-script

2008-09-26 Thread Julien Claassen
The '/' is a vi(m) thing. If you belong to the wrong editor-religion i.e. emacs, you might not know. Me not being one of the emacsuns I don't know if you have it. :-) Music was my first love and it will be my last (John Miles) FIND MY WEB-PROJECT AT: http://ltsb.sourc

Re: [LAD] [ot] capitalising words in a shell-script

2008-09-26 Thread Wolfgang Woehl
Emanuel Rumpf: > python -c "d='monday'.capitalize(); print d[0:3]" Instan methods, whoa. You win :) Can you get rid of d? Wolfgang ___ Linux-audio-dev mailing list Linux-audio-dev@lists.linuxaudio.org http://lists.linuxaudio.org/mailman/listinfo/linux-a

Re: [LAD] [ot] capitalising words in a shell-script

2008-09-26 Thread Wolfgang Woehl
Jens M Andreasen: > You never mentioned the forward slash in our tent camp. Is i it so > that everybody else - that is important, knows the meaning of > s/junk/gold ? Well, Bill Gates comes to mind. But then that's not entirely fair or true, is it? Be good, Wolfgang

Re: [LAD] [ot] capitalising words in a shell-script

2008-09-26 Thread Emanuel Rumpf
2008/9/27 Wolfgang Woehl <[EMAIL PROTECTED]>: > Emanuel Rumpf: > >> python -c "d='monday'.capitalize(); print d[0:3]" > > Instan methods, whoa. You win :) Can you get rid of d? > like this: ? python -c "print 'monday'[:3].capitalize()" with use of stdin: echo "monday" | python -c "import sys; p

Re: [LAD] [ot] capitalising words in a shell-script

2008-09-26 Thread Wolfgang Woehl
Emanuel Rumpf: > python -c "print 'monday'[:3].capitalize()" Slick. I knew sed wouldn't stand a chance \) Wolfgang ___ Linux-audio-dev mailing list Linux-audio-dev@lists.linuxaudio.org http://lists.linuxaudio.org/mailman/listinfo/linux-audio-dev

Re: [LAD] [ot] capitalising words in a shell-script

2008-09-26 Thread Jens M Andreasen
On Sat, 2008-09-27 at 01:11 +0200, Julien Claassen wrote: > The '/' is a vi(m) thing. If you belong to the wrong editor-religion i.e. > emacs, you might not know. Me not being one of the emacsuns I don't know if > you have it. :-) I use the dreaded editor emacs everyday, thankyou - but more impo

Re: [LAD] [ot] capitalising words in a shell-script

2008-09-26 Thread Julien Claassen
Hi! I also use C and c++, but not for this problem, Too many external packages involved anyway. Announcement is coming up. :-) Kindest regards Julien Music was my first love and it will be my last (John Miles) FIND MY WEB-PROJECT AT: http://ltsb.sour

Re: [LAD] [ot] capitalising words in a shell-script

2008-09-26 Thread Luis Garrido
Scripting is for pansies, real hAxXoRs and with 0xDF. ___ Linux-audio-dev mailing list Linux-audio-dev@lists.linuxaudio.org http://lists.linuxaudio.org/mailman/listinfo/linux-audio-dev

Re: [LAD] [ot] capitalising words in a shell-script

2008-09-26 Thread Julien Claassen
Oh scripting is a very potent and powerful thing, if you know where to go and what to do. :-) Truly: Everything in its place. Kindest regards Julien Music was my first love and it will be my last (John Miles) FIND MY WEB-PROJECT AT: http://ltsb.sourcefo

Re: [LAD] [ot] capitalising words in a shell-script

2008-09-26 Thread victor
Gone is the dream of UNIX. Long it live. > Solutions of simple problems, demanding several complex packages to be > piped into one each other, does not take my fancy. > > ___ > Linux-audio-dev mailing list > Linux-audio-dev@lists.linuxaudio.org > http:

Re: [LAD] [ot] capitalising words in a shell-script

2008-09-26 Thread Jens M Andreasen
On Sat, 2008-09-27 at 00:44 +0100, victor wrote: > Gone is the dream of UNIX. Long it live. > I dunno what your dream is? ... But my nightmare is the day when procesors gets so powerful so that the new kids on the block decides to rewrite the (Linux)kernel in javascript! > > > Solutions of simp

Re: [LAD] [ot] capitalising words in a shell-script

2008-09-27 Thread victor
Well, that dream was not mine but Dennis Ritchie's and Ken Thompson's... - Original Message - From: "Jens M Andreasen" <[EMAIL PROTECTED]> To: "victor" <[EMAIL PROTECTED]> Cc: Sent: Saturday, September 27, 2008 1:31 AM Subject: Re: [LAD] [ot] c

Re: [LAD] [ot] capitalising words in a shell-script

2008-09-27 Thread Emanuel Rumpf
2008/9/27 Jens M Andreasen <[EMAIL PROTECTED]>: > ... But my nightmare is the day when > procesors gets so powerful so that the new kids on the block decides to > rewrite the (Linux)kernel in javascript! > Still in planning stage, but maybe not that far away: http://sourceforge.net/projects/cleese

Re: [LAD] [ot] capitalising words in a shell-script

2008-09-27 Thread Jens M Andreasen
On Sat, 2008-09-27 at 12:04 +0200, Emanuel Rumpf wrote: > Still in planning stage, but maybe not that far away: > http://sourceforge.net/projects/cleese/ > > > >> > Solutions of simple problems, demanding several complex packages to be > >> > piped into one each other, does not take my fancy. > >