Change lowercase to upper case


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Change lowercase to upper case
# 1  
Old 05-10-2013
Change lowercase to upper case

dear all,

i have file input

Code:
ABCDE_Asta_Key_Park,COJ050,10.142.3.150
C_BDEFG_City_Lake,C_BIR0,10.135.3.6
C_FDGEBIR_Axaudia,C_ABIR1,10.135.3.34

I want to change lowercase in to uppercase for all strings

output
Code:
ABCDE_ASTA_KEY_PARK,COJ050,10.142.3.150
C_BDEFG_CITY_LAKE,C_BIR0,10.135.3.6
C_FDGEBIR_AXAUDIA,C_ABIR1,10.135.3.34

thanks
# 2  
Old 05-10-2013
Hi Radius,
You can make all uppercase with the below :
Code:
awk '{print toupper($0)}' file

or
Code:
tr "a-z" "A-Z" <file

# 3  
Old 05-10-2013
i have run the second code before but the result were in irregular pattern
but the first code is the answer..thanks
# 4  
Old 05-10-2013
input_file :

Code:
ABCDE_ASTA_KEY_PARK,COJ050,10.142.3.150
C_BDEFG_CITY_LAKE,C_BIR0,10.135.3.6
C_FDGEBIR_AXAUDIA,C_ABIR1,10.135.3.34


o/p :
Code:
tr '[A-Z]' '[a-z]' < input_file
abcde_asta_key_park,coj050,10.142.3.150
c_bdefg_city_lake,c_bir0,10.135.3.6
c_fdgebir_axaudia,c_abir1,10.135.3.34

This User Gave Thanks to zozoo For This Post:
# 5  
Old 05-10-2013
ok..i missed the single quotes..tks
# 6  
Old 05-10-2013
A locale-independent method is to use character classes, i.e.
Code:
$ tr "[:upper:]" "[:lower:]" < infile
abcde_asta_key_park,coj050,10.142.3.150
c_bdefg_city_lake,c_bir0,10.135.3.6
c_fdgebir_axaudia,c_abir1,10.135.3.34

 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Convert lowercase to upper case in Sparc

Hi, I need to convert the hostname to uppercase and attach it to a string. eg: $hostname output mymac Final output should be Production.MYMAC (3 Replies)
Discussion started by: mohtashims
3 Replies

2. Shell Programming and Scripting

Change first letter of a word from lower case to upper case

Hi all, I am trying to find a way to change first letter in a word from lower case to upper case. It should be done for each first word in text or in paragraph, and also for each word after punctuation like . ; : ! ?I found the following command sed -i 's/\s*./\U&\E/g' $@ filenamebut... (7 Replies)
Discussion started by: georgi58
7 Replies

3. Shell Programming and Scripting

Problem with upper and lowercase in awk

My awk (GNU Awk 3.1.8 on Ubuntu 12.04) seems to ignore case. cat file abc ABC aBc 123 awk '//&&//{print $0,"";next}{print $0,""}' file My result:abc ABC aBc 123 Correct result:abc ABC aBc 123 (6 Replies)
Discussion started by: Jotne
6 Replies

4. Shell Programming and Scripting

SED (or other) upper to lowercase, with first letter of first word in each sentence uppercase

The title pretty much defines the problem. I have text files that are all in caps. I would like to convert them to lowercase, but have the first letter of the first word in each sentence in uppercase. I already have SED on the server for fixing / tweaking text files, but I'm open to other... (5 Replies)
Discussion started by: dockline
5 Replies

5. Shell Programming and Scripting

Convert lowercase to upper case based on certain conditions

Hello Unix Gurus : It would be really great if a solution can be found Following is the condition on Solaris Change all the records to upper case ignore the case for records having "A2B2 " in them . how can i use nawk or any other command Following is the SAMPLE INPUT... (6 Replies)
Discussion started by: tsbiju
6 Replies

6. Shell Programming and Scripting

[Solved] Change Upper case to Lower case in C shell

Is there a command that can switch a character variable from UPPER case to lower case? like foreach AC ( ABC BCD PLL QIO) set ac `COMMAND($AC)` ... end Thanks a lot! (3 Replies)
Discussion started by: rockytodd
3 Replies

7. Shell Programming and Scripting

data array needs to change upper case to lower case

Hi all, i have a data array as followes. ARRAY=DFSG345GGG ARRAY=234FDFG090 ARRAY=VDFVGBGHH so on.......... i need all english letters to be change to lower case. So i am expecting to see ARRAY=dfsg345ggg ARRAY=234fdfg090 ARRAY=vdfvgbghh so on........ If i have to copy this data in... (8 Replies)
Discussion started by: usustarr
8 Replies

8. UNIX for Dummies Questions & Answers

replacing all 4 first upper char of every rec to lowercase ?

I have a file where some records have been updated the wrong way and need to fix it quickly since the amount can be alot. Every record where any of the first 4 characters are in upper case need to be changed to lowercase. Records can have '#' in position-1 for comments. These musn't be... (2 Replies)
Discussion started by: Browser_ice
2 Replies

9. Shell Programming and Scripting

after i convert upper case to lowercase

If user chosen to tolower then it should convert file name to lower or vice versa. when file names converted it should put into appropriate subdirectories. e.g when files converted it then seperate them out with file etension where it will seperate them out . such as file.pdf, phone.doc both... (1 Reply)
Discussion started by: Alex20
1 Replies

10. UNIX for Dummies Questions & Answers

lower case to upper case string conversion in shell script

How can convert a Lower case variable value to an upper case in the kron shell script. (3 Replies)
Discussion started by: dchalavadi
3 Replies
Login or Register to Ask a Question