Convert string to uppercase


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Convert string to uppercase
# 1  
Old 11-13-2009
Convert string to uppercase

i have this piece of small code that checks for *.CSV files.

Code:
  NUMFILES=`ls -1 *.CSV | wc -l`

  for filename in $(ls -1 *.CSV)
  do
    ...
  done

it works only if the files has an uppercase of *.CSV extension. however, when there is a file of the same type but has lowercase *.csv extension it does not work. how do i convert them to read as uppercase? or ignore the uppercase or lowercase types?

thanks,
warren
# 2  
Old 11-13-2009
Maybe.

Code:
for filename in *.[cC][sS][vV]

 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to uppercase matching line when string found?

Hello, Could you please help me how to search the string in a file, and when found; change the existing line to uppercase in command line? I tried: ?whichcommand? -A "EXT" fileA | awk '{print tolower($0)}' | tee fileB tr command simply converts entire file to uppercase but this is not what... (4 Replies)
Discussion started by: baris35
4 Replies

2. Shell Programming and Scripting

Find Files and then convert them to Uppercase

Hi All, So I'm new to scripting and I've been put in a position to convert a bunch of files with specific extensions in a folder and all its subfolders to uppercase including their extension. I figure so far I could do something like this: ... ... and then input $line into another bash... (12 Replies)
Discussion started by: ideal2545
12 Replies

3. Shell Programming and Scripting

convert to uppercase in specific table

Hi All, I'm a newbie here, i'm just wondering is it possible to convert into uppercase the records in specific field? ex. table name = mytable field1 field2 field3 abd erfdF fdsfdsfsd how can i convert into uppercase the field2 using sybase? Please advise, ... (2 Replies)
Discussion started by: nikki1200
2 Replies

4. Shell Programming and Scripting

Convert lowercase to uppercase

listprocs.sh contains ps -ef | grep "swikar" 1) Write a shell script to convert an input file to all upper case. Name your shell script toupper.sh. Hint: tr ' ' ' ' will convert all lower case letters to upper case To use your script, try the following command: cat... (1 Reply)
Discussion started by: swikar
1 Replies

5. Shell Programming and Scripting

Check whether a string begin with uppercase, lowercase or digit!

Hi every body! I wrote script on Fedora (bash shell) to check whether a tring enter from user console is start with a uppercase/lowercase letter or a digit. But with this script i have some problem when I enter from character from 'b' to 'z' --> result is uppercase. This code look like ok but i... (9 Replies)
Discussion started by: nguyendu0102
9 Replies

6. Shell Programming and Scripting

how to convert user input to uppercase

Hi, how to convert user input (lowercase) to uppercase in the dos batch file ? echo. SET /p user1=Enter username: SET user2=%user1%V echo. echo %user1% echo. echo %user2% echo. With Regards (7 Replies)
Discussion started by: milink
7 Replies

7. Shell Programming and Scripting

Convert the first letter of each line to uppercase

Hi, I have the following file: /* ----------------- ADP2DAILY_Box ----------------- */ insert_job: ADP2DAILY_Box job_type: b owner: mbprwork permission: gx,wx date_conditions: 1 days_of_week: mo,tu,we,th,fr exclude_calendar: mtg_holidays start_times: "1:00" description: "Process Daily... (4 Replies)
Discussion started by: ramky79
4 Replies

8. Shell Programming and Scripting

Replace a string in quote to uppercase

Hi, I need to find all strings in single quote and change the case of the string to UPPER. Example: Input: xyz abc ccc 'zxxx7U' dfsdf sdfdd aaa 'oR77' and 'or88' Output: xyz abc ccc 'ZXXX7U' dfsdf sdfdd aaa 'OR77' and 'OR88' Appreciate your help!! Thanks Selva (6 Replies)
Discussion started by: selkum
6 Replies

9. Shell Programming and Scripting

sed help to convert from lowercase to uppercase and vice versa!

Hello, can sed be used to convert all letters of a file from uppercase to lowercase and vice versa?i know tr command can be used but with sed is it possible? i came up with this :- sed 'y///' file1 actually the above command is also not working! Please help me. Thanks in advance :) (6 Replies)
Discussion started by: salman4u
6 Replies

10. Shell Programming and Scripting

How convert lowercase or uppercase

It will only accept one argument where it should be upper or lowercase. if user choose to convert filnames to upper case than it should convert to upper or vice versa. if no action taken by the user then should not do anything any of the files in the current directory. (5 Replies)
Discussion started by: Alex20
5 Replies
Login or Register to Ask a Question