Sponsored Content
Top Forums Shell Programming and Scripting how to convert user input to uppercase Post 302480449 by R0H0N on Wednesday 15th of December 2010 02:06:55 AM
Old 12-15-2010
Code:
SETLOCAL ENABLEDELAYEDEXPANSION
SET String=Abc
SET String
CALL :UpCase String
SET String
CALL :LoCase String
SET String
ENDLOCAL
GOTO:EOF

:LoCase
:: Subroutine to convert a variable VALUE to all lower case.
:: The argument for this subroutine is the variable NAME.
SET %~1=!%1:A=a!
SET %~1=!%1:B=b!
SET %~1=!%1:C=c!
SET %~1=!%1:D=d!
SET %~1=!%1:E=e!
SET %~1=!%1:F=f!
SET %~1=!%1:G=g!
SET %~1=!%1:H=h!
SET %~1=!%1:I=i!
SET %~1=!%1:J=j!
SET %~1=!%1:K=k!
SET %~1=!%1:L=l!
SET %~1=!%1:M=m!
SET %~1=!%1:N=n!
SET %~1=!%1:O=o!
SET %~1=!%1:P=p!
SET %~1=!%1:Q=q!
SET %~1=!%1:R=r!
SET %~1=!%1:S=s!
SET %~1=!%1:T=t!
SET %~1=!%1:U=u!
SET %~1=!%1:V=v!
SET %~1=!%1:W=w!
SET %~1=!%1:X=x!
SET %~1=!%1:Y=y!
SET %~1=!%1:Z=z!
GOTO:EOF

:UpCase
:: Subroutine to convert a variable VALUE to all upper case.
:: The argument for this subroutine is the variable NAME.
SET %~1=!%1:a=A!
SET %~1=!%1:b=B!
SET %~1=!%1:c=C!
SET %~1=!%1:d=D!
SET %~1=!%1:e=E!
SET %~1=!%1:f=F!
SET %~1=!%1:g=G!
SET %~1=!%1:h=H!
SET %~1=!%1:i=I!
SET %~1=!%1:j=J!
SET %~1=!%1:k=K!
SET %~1=!%1:l=L!
SET %~1=!%1:m=M!
SET %~1=!%1:n=N!
SET %~1=!%1:o=O!
SET %~1=!%1:p=P!
SET %~1=!%1:q=Q!
SET %~1=!%1:r=R!
SET %~1=!%1:s=S!
SET %~1=!%1:t=T!
SET %~1=!%1:u=U!
SET %~1=!%1:v=V!
SET %~1=!%1:w=W!
SET %~1=!%1:x=X!
SET %~1=!%1:y=Y!
SET %~1=!%1:z=Z!
GOTO:EOF


Last edited by Franklin52; 12-15-2010 at 06:47 AM.. Reason: Code tags
R0H0N
 

10 More Discussions You Might Find Interesting

1. 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

2. 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

3. UNIX for Dummies Questions & Answers

Convert string to uppercase

i have this piece of small code that checks for *.CSV files. 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... (1 Reply)
Discussion started by: wtolentino
1 Replies

4. 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

5. 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

6. 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

7. Shell Programming and Scripting

Validating uppercase/lowercase of user input with perl compared to unix folders

Hi, I need to copy files from a source directory to a destination directory in unix. I'm using the file::copy for the actual copy. The problem is that the source and dest directories are supplied by different users, who might type the name of the directories in various combinations of lower... (6 Replies)
Discussion started by: Furou
6 Replies

8. 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

9. Shell Programming and Scripting

How to get the user input recursively until the user provides valid input

Hi, echo "Enter file name of input file list along with absolute path : " read inputFileList if then for string in `cat inputFileList` do echo $string done else echo " file does not exist" fi From the above code, if the user enters a invalid file... (1 Reply)
Discussion started by: i.srini89
1 Replies

10. Shell Programming and Scripting

User input and run awk using the input

I am trying to allow a user to enter in text and then store that text in a variable $gene to run in an awk command in which those values are used to run some calculations. I am getting syntax errors however, when I try. Thank you :). The awk runs great if it is a pre-defined file that is used,... (7 Replies)
Discussion started by: cmccabe
7 Replies
SET 
CONSTRAINTS(7) SQL Commands SET CONSTRAINTS(7) NAME
SET CONSTRAINTS - set constraint checking modes for the current transaction SYNOPSIS
SET CONSTRAINTS { ALL | name [, ...] } { DEFERRED | IMMEDIATE } DESCRIPTION
SET CONSTRAINTS sets the behavior of constraint checking within the current transaction. IMMEDIATE constraints are checked at the end of each statement. DEFERRED constraints are not checked until transaction commit. Each constraint has its own IMMEDIATE or DEFERRED mode. Upon creation, a constraint is given one of three characteristics: DEFERRABLE INITIALLY DEFERRED, DEFERRABLE INITIALLY IMMEDIATE, or NOT DEFERRABLE. The third class is always IMMEDIATE and is not affected by the SET CONSTRAINTS command. The first two classes start every transaction in the indicated mode, but their behavior can be changed within a transaction by SET CONSTRAINTS. SET CONSTRAINTS with a list of constraint names changes the mode of just those constraints (which must all be deferrable). The current schema search path is used to find the first matching name if no schema name is specified. SET CONSTRAINTS ALL changes the mode of all deferrable constraints. When SET CONSTRAINTS changes the mode of a constraint from DEFERRED to IMMEDIATE, the new mode takes effect retroactively: any outstanding data modifications that would have been checked at the end of the transaction are instead checked during the execution of the SET CON- STRAINTS command. If any such constraint is violated, the SET CONSTRAINTS fails (and does not change the constraint mode). Thus, SET CON- STRAINTS can be used to force checking of constraints to occur at a specific point in a transaction. Currently, only foreign key constraints are affected by this setting. Check and unique constraints are always effectively not deferrable. Triggers that are declared as ``constraint triggers'' are also affected. NOTES
This command only alters the behavior of constraints within the current transaction. Thus, if you execute this command outside of a trans- action block (BEGIN/COMMIT pair), it will not appear to have any effect. COMPATIBILITY
This command complies with the behavior defined in the SQL standard, except for the limitation that, in PostgreSQL, it only applies to for- eign-key constraints. SQL - Language Statements 2010-05-14 SET CONSTRAINTS(7)
All times are GMT -4. The time now is 01:31 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy