In today's post we cover a simple problem - change the case of text i.e either from lowercase to uppercase or vice versa. Let's look at a few examples.
Let's say I have a file SedText.rtf as follows :
Now for converting the file into all Uppercase from the command line, use the following :
Similarly for converting from uppercase to lowercase, use the following command :
Let's say I have a file SedText.rtf as follows :
1.Here is a cute little tutorial for
2.trying out different things using
3.the Stream Editor or Sed in Unix.
4.The author of this tutorial is
5.none other than IroncladWriter
6.himself. The tutorial aims to
7.teach folks and educate how
8.they could unlock the power
9.of Unix to the fullest. Am posting
10.this on the blog IronCladZone
11.The best blog on the whole of
12.internet, where you can learn
13.technical stuff as well enjoy
14.entertaining tidbits like movies,
15.music, television, fashion, food,
16.shopping, travel, trends etc.
17.Just sit back, relax and
18.ENJOY THE RIDE :)
tr a-z A-Z < SedText.rtf
Output :
1.HERE IS A CUTE LITTLE TUTORIAL FOR\
2.TRYING OUT DIFFERENT THINGS USING\
3.THE STREAM EDITOR OR SED IN UNIX.\
4.THE AUTHOR OF THIS TUTORIAL IS\
5.NONE OTHER THAN IRONCLADWRITER\
6.HIMSELF. THE TUTORIAL AIMS TO\
7.TEACH FOLKS AND EDUCATE HOW\
8.THEY COULD UNLOCK THE POWER\
9.OF UNIX TO THE FULLEST. AM POSTING\
10.THIS ON THE BLOG IRONCLADZONE\
11.THE BEST BLOG ON THE WHOLE OF\
12.INTERNET, WHERE YOU CAN LEARN\
13.TECHNICAL STUFF AS WELL ENJOY \
14.ENTERTAINING TIDBITS LIKE MOVIES,\
15.MUSIC, TELEVISION, FASHION, FOOD,\
16.SHOPPING, TRAVEL, TRENDS ETC.\
17.JUST SIT BACK, RELAX AND\
18.ENJOY THE RIDE :)
Similarly for converting from uppercase to lowercase, use the following command :
tr A-Z a-z < SedText.rtf
No comments:
Post a Comment