TUTSVNN.TK : Chuyển từ chữ hoa sang chữ thường và ngược
lại như thế nào? Trong linux có hơn một cách để làm điều này:
- dd
$ dd if=input.txt of=output.txt conv=lcase
- tr
$ tr '[:upper:]' '[:lower:]' < input.txt > output.txt
- awk
$ awk '{ print tolower($0) }' input.txt > output.txt
- perl
$ perl -pe '$_= lc($_)' input.txt > output.txt
- sed
$ sed -e 's/\(.*\)/\L\1/' input.txt > output.txt
Làm ngược lại: chuyển chữ hoa thành chữ thường:
- dd
$ dd if=input.txt of=output.txt conv=ucase
- tr
$ tr '[:lower:]' '[:upper:]' < input.txt > output.txt
- awk
$ awk '{ print toupper($0) }' input.txt > output.txt
- perl
$ perl -pe '$_= uc($_)' input.txt > output.txt
- sed
$ sed -e 's/\(.*\)/\U\1/' input.txt > output.txt
TUTSVNN.TK