How to convert text files to all upper or lower case
How can you convert a text file to all lower case or all upper case?
As usual, in Linux, there are more than 1 way to accomplish a task.
To convert a file (input.txt) to all lower case (output.txt), choose
any ONE of the following:
* dd
$ dd if=input.txt of=output.txt conv=lcase
* tr
$ tr '[:upper:]' '[:lower:]' <> 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
We use the backreference \1 to refer to the entire line and the
\L to convert to lower case.
To convert a file (input.txt) to all upper case (output.txt):
* dd
$ dd if=input.txt of=output.txt conv=ucase
* tr
$ tr '[:lower:]' '[:upper:]' <> 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
Related Posts (ajax)
Labels
3g
aaa
Ajax
all leagues
belajar
billing
books
cdma
cdr
cisco
evdo
friends
google
gsm
hspda
hsupa
ims
indonesia
IP
islam
jquery
kpi
leadership
linux
lte
map
mediasi
mml
monitor
moshell
mpls
network
nokia
omc
oracle
oss
paging
parma
performance
perl
players
politics
pstn
radio
script
shell scipt
siemens
signalling
songs
story
switching
telecom
tips
tools
umts
voip
wimax
windows
0 Comment :
Post a Comment