Jul 29, 2005 #1 ogniemi Technical User Joined Nov 7, 2003 Messages 1,041 Location PL what i need is to change: QWERTYUIO ASDFG ZXCVBNM with Qwertyuio Asdfg Zxcvbnm
Jul 29, 2005 #2 duncdude Programmer Joined Jul 28, 2003 Messages 1,979 Location GB in Perl? Code: [b]#!/usr/bin/perl[/b] while (<DATA>) { print ucfirst lc($_); } __DATA__ QWERTYUIO ASDFG ZXCVBNM Kind Regards Duncan Upvote 0 Downvote
in Perl? Code: [b]#!/usr/bin/perl[/b] while (<DATA>) { print ucfirst lc($_); } __DATA__ QWERTYUIO ASDFG ZXCVBNM Kind Regards Duncan
Jul 29, 2005 #3 Annihilannic MIS Joined Jun 22, 2000 Messages 6,317 Location AU Presuming it's always going to be the first character on each line you want to convert to upper case, this should do it: [tt]awk ' { print substr($0,1,1) tolower(substr($0,2)) } '[/tt] Annihilannic. Upvote 0 Downvote
Presuming it's always going to be the first character on each line you want to convert to upper case, this should do it: [tt]awk ' { print substr($0,1,1) tolower(substr($0,2)) } '[/tt] Annihilannic.
Jul 29, 2005 #4 feherke Programmer Joined Aug 5, 2002 Messages 9,541 Location RO Hi Duncan, I see you still not use the [tt]perl[/tt]'s switches. I think they are pretty. A read, loop, maybe a print too, for free. Code: perl -ne 'print ucfirst lc' inputfile [gray]# or[/gray] perl -pe 's/(.)(.*)/uc($1).lc$2/e' inputfile Feherke. http://rootshell.be/~feherke/ Upvote 0 Downvote
Hi Duncan, I see you still not use the [tt]perl[/tt]'s switches. I think they are pretty. A read, loop, maybe a print too, for free. Code: perl -ne 'print ucfirst lc' inputfile [gray]# or[/gray] perl -pe 's/(.)(.*)/uc($1).lc$2/e' inputfile Feherke. http://rootshell.be/~feherke/
Jul 29, 2005 #5 duncdude Programmer Joined Jul 28, 2003 Messages 1,979 Location GB Nice one feherke! I'll have to do some reading... Kind Regards Duncan Upvote 0 Downvote