RE: upper/lower case

"MOKRANI Rachid [email protected] [sed-users]" <[email protected]>
Newsgroups gmane.editors.sed.user
Message-ID <[email protected]>
Hi Rakesh,

Your perl exemple work great.  

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

Could you explain it ?

Where are you specify  the colum number to apply this perl command  ? 
If I want to apply this command on the colum 9 or 7 etc.... how to do it ?


Personally I prefer sed/awk. But if I did not find I will keep this perl command.

Thanks very much.


-----Message d'origine-----
De : [email protected] [mailto:[email protected]] 
Envoyé : vendredi 11 décembre 2015 09:08
À : [email protected]
Objet : Re: upper/lower case



 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]



------------------------------------
Posted by: [email protected]
------------------------------------

-- 

------------------------------------

Yahoo Groups Links



__________________________
Avant d'imprimer, pensez à l'environnement ! Please consider the environment before printing ! 
Ce message et toutes ses pièces jointes sont confidentiels et établis à l'intention exclusive de ses destinataires. Toute utilisation non conforme à sa destination, toute diffusion ou toute publication, totale ou partielle, est interdite, sauf autorisation expresse. IFP Energies nouvelles décline toute responsabilité au titre de ce message. This message and any attachments are confidential and intended solely for the addressees. Any unauthorised use or dissemination is prohibited. IFP Energies nouvelles should not be liable for this message.
__________________________
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.