Hi,
I have files with all its characters in lower cases. I need to change them to "proper case" (starting char to be come Upper case). How can I? Pls suggest.
for e.g. xyz.txt should become Xyz.txt
TIA
Prvn
Hi,
I have files with all its characters in lower cases. I need to change them to "proper case" (starting char to be come Upper case). How can I? Pls suggest.
for e.g. xyz.txt should become Xyz.txt
TIA
Prvn
With zsh:
zsh 4.3.4% touch xyz.txt abc.txt
zsh 4.3.4% autoload -U zmv
zsh 4.3.4% zmv '(*).(*)' '${(C)1}.$2'
zsh 4.3.4% ls
Abc.txt Xyz.txt
if you can use Python:
# echo "abc.txt" | python -c "print raw_input().capitalize()"
Abc.txt
Thanks ghostdog74 & radoulov.
I'm allowed to use bash/ksh/sh only.
Prvn
echo "abc.txt" | awk 'BEGIN{OFS=FS=""}{$1=toupper($1);print}'
Hi Ghostdog,
I am getting abc.txt as it as but Abc.txt was expected.
#echo "abc.txt" | awk 'BEGIN{OFS=FS=""}{$1=toupper($1);print}'
abc.txt
#
Thanks
Hi Ghostdog,
I installed gawk 3.1.5 and your solution worked great.
Thanks much
Prvn
In straight shell
filename=abc.txt
typeset -u first=$(expr substr $filename 1 1)
mv $filename $first$(expr substr $filename 2 ${#filename})