Re: upper/lower case

"[email protected] [sed-users]" <[email protected]>
Newsgroups gmane.editors.sed.user
Message-ID <[email protected]>

 Since you don't have GNU sed, you could perform your transformation
 utilizing the regular sed as follows:
 

 sed -e '
 h
 s/;/\
 /3
 s/\n.*//
 s/;/\
 /2
 s/.*\n//
 y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/
 s/\<\([a-z]\)/\
 \1/g
 s/$/\
 /
 s//\
 aA/
 s//\
 bB/
 s//\
 cC/
 s//\
 dD/
 s//\
 eE/
 s//\
 fF/
 s//\
 gG/
 s//\
 hH/
 s//\
 iI/
 s//\
 jJ/
 s//\
 kK/
 s//\
 lL/
 s//\
 mM/
 s//\
 nN/
 s//\
 oO/
 s//\
 pP/
 s//\
 qQ/
 s//\
 rR/
 s//\
 sS/
 s//\
 tT/
 s//\
 uU/
 s//\
 vV/
 s//\
 wW/
 s//\
 xX/
 s//\
 yY/
 s//\
 zZ/
 

 :a
 s/\n\(a\)\(.*\)\(\n.*\n\1\)\(A\)\(.*\)/\4\2\3\4\5/;ta
 s/\n\(.\)\(.*\)\(\n\n.*\n\1\)\(.\)\(.*\)/\4\2\3\4\5/;ta
 

 x;G;s/\n\n.*//
 s/;/\
 /3
 s/;/\
 /2
 s/\n\(.*\)\n\(.*\)\n\(.*\)/;\3;\2/
 ' yourfile

 

 

 with Perl it can be accomplished in a much simplified manner:
 

 perl -F\; -pale '
    s/\b(\w+)/\u\L$1/g for $F[2];
    $_=join";",@F;
 ' yourfile
 

 HTH
 

 -Rakesh
 

 




[Non-text portions of this message have been removed]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.