Cannot find correct syntax to make file name uppercase letters


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Cannot find correct syntax to make file name uppercase letters
# 1  
Old 03-09-2017
Cannot find correct syntax to make file name uppercase letters

I have a file name :
Code:
 var=UsrAccChgRpt

I want to make them upper case.
Tried:
Code:
 $var | tr [a z A Z]

Error:

Code:
tr: Invalid combination of options and Strings.
Usage: tr [ [-c|-C] | -[c|C]ds | -[c|C]s | -ds | -s ] [-A] String1 String2
tr { -[c|C]d | -[c|C]s | -d | -s } [-A] String1


Could you please help. I am using AIX Bourne shell
# 2  
Old 03-09-2017
Perhaps this link will help point you in the right direction.
Converting to Uppercase
# 3  
Old 03-09-2017
Quote:
Originally Posted by digioleg54
I have a file name :
Code:
 var=UsrAccChgRpt

I want to make them upper case.
Tried:
Code:
 $var | tr [a z A Z]

Error:

Code:
tr: Invalid combination of options and Strings.
Usage: tr [ [-c|-C] | -[c|C]ds | -[c|C]s | -ds | -s ] [-A] String1 String2
tr { -[c|C]d | -[c|C]s | -d | -s } [-A] String1


Could you please help. I am using AIX Bourne shell
Your request is not at all clear. You say you have a file name, but what you have shown us is a variable containing a string (which might or might not be a file name). You then attempt to execute a file with the name stored in that string and use the tr utility to modify the output produced by executing that file.

joeyg gave you a pointer to a thread that shows some ways to use tr or awk or ksh to convert a string read from standard input or the contents of a variable to upper case. But I have no idea what you are trying to with $var, so I don't know if any of those suggestions will help.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

How to form a correct syntax to sift out according to complementary patterns with 'find'?

I need to find all files and folders containing keyword from the topmost directory deep down the tree but omitting all references to keyword in web-search logs and entries, i.e. excluding search and browsing history made using web-browser1, web-browser2, web-browser3, (bypassing all entries of the... (8 Replies)
Discussion started by: scrutinizerix
8 Replies

2. Shell Programming and Scripting

Trying to find number of uppercase and lowercase letters.

Hello Guys, I am writing a script which check each line for how many Uppercase and Lowercase letter of a given file. Please check my script as follow: l=0 while read line do echo Line `expr $l + 1` has ` tr -cd "" < $line | wc -c` uppercase letters and `tr -cd "" < $line | wc -c`... (3 Replies)
Discussion started by: kasparov
3 Replies

3. Shell Programming and Scripting

Do syntax is correct ?

I tried with sed command to create a space between namespace from the XML file. I used this syntax. Can someone tell me is this syntax is vaild? /usr/xpg4/bin/sed -e 's/<\/^.*><^.:Errort>/<\/^.*> <^.:Errort>/g' test > test2 I dint find any changes or any space being created between... (10 Replies)
Discussion started by: raghunsi
10 Replies

4. Shell Programming and Scripting

Make the first character uppercase

Input: hello world monkey Output should be: Hello World Monkey How can it be done with perl,sed,awk or bash? (9 Replies)
Discussion started by: cola
9 Replies

5. UNIX for Dummies Questions & Answers

Searching for three or four Uppercase Letters within a file

Looking how to find only three or four letter strings using grep in a file called hello: file contains: TIT TAT RATA ERAT RATE HI RE CA PA CHANGE SANDY ANSWER I am using the code: (4 Replies)
Discussion started by: auerbeck.tyler
4 Replies

6. UNIX Desktop Questions & Answers

Correct syntax

Hi, I want to check if file(s) exist even in subdirectories and perform an action. After searching here couldn't find solution that would work, but made my own solution that works fine: if then echo egrep "$1|$2|$3" `find| grep MLOG` else echo "MLOG does not exist" fiThat will check... (1 Reply)
Discussion started by: Vitoriung
1 Replies

7. Shell Programming and Scripting

if [ $NOWDATE -gt $STARTDATE ] , date comparison correct syntax?

i've looked at a bunch of the date comparison threads on these boards but unfortunately not been able to figure this thing out yet. still confused by some of the way conditionals handle variables... here is what i where i am now... # a bunch of initializition steps are here ...... (1 Reply)
Discussion started by: danpaluska
1 Replies

8. Shell Programming and Scripting

Plz correct my syntax of shell script

Dear all I am still bit new in shell script area.I am writing down a shell script which I guess somewhere wrong so please kindly correct it. I would be greatful for that. What I actually want from this shell script is that it will move all the files one by one to another server which can be... (2 Replies)
Discussion started by: girish.batra
2 Replies

9. UNIX for Dummies Questions & Answers

make uppercase

If in a script I am taking an input (R201) for example and assigning it to a variable, how would I change the R to uppercase if it was keyed in as r201? I can't seem to get it to work with toupper (4 Replies)
Discussion started by: kirkm76
4 Replies

10. Shell Programming and Scripting

How can I find the 3 first letters from the name file

Hello, I have a name file in Unix for example : ABC_TODAYFirst.001 and I want just capture or display the 3 first letters so : ABC. I tried with cut -c,1-3 and the name but it displays the 3 first letters of all lines. Can you help , Thanks a lot (8 Replies)
Discussion started by: steiner
8 Replies
Login or Register to Ask a Question