| Newsgroups |
gmane.editors.sed.user |
| Message-ID |
<[email protected]> |
> perl -aF\; -pe'$F[2*($.>1)]=~s/(\w+)/\u\L$1/g;$_=join";",@F' input.txt
This is not exactly foolproof, since it alters the first field of the first line of
input.txt.
One way to skip the first line:
perl -aF\; -pe'$F[$.>1?2:next]=~s/(\w+)/\u\L$1/g;$_=join";",@F' input.txt
---In [email protected], <rvtol@...> wrote :
Perl-variant that skips line 1:
perl -aF\; -pe'$F[2*($.>1)]=~s/(\w+)/\u\L$1/g;$_=join";",@F' input.txt
Clearer, commented version:
perl -aF\; -pe ' # split each line on \;
next if $. == 1; # skip line 1
s/(\w+)/\u\L$1/g for $F[2]; # tcase(lcase) each word of field2
$_ = join ";", @F; # glue all fields back together again
' input.txt
-- Ruud
For debugging, try: s/(\w+)/[$1->\u\L$1]/g
[Non-text portions of this message have been removed]