Sponsored Content
Top Forums Shell Programming and Scripting converting to lower case or upper case Post 302578129 by 14th on Thursday 1st of December 2011 12:42:04 AM
Old 12-01-2011
why don't use sed or tr?

Code:
column_name="vivek"
column_name2="ViVeK"
column_name=$(echo  $column_name | tr '[:upper:]' '[:lower:]')
column_name2=$(echo  $column_name2 | tr '[:upper:]' '[:lower:]')

                       echo "column name 1 lower: $column_name"
                        echo "column name 2 lower: $coulmn_name2"
  
# I think maybe you should use double equal sign
if [[ "$column_name" == "$column_name2" ]]
then
        echo "matching"
fi

This User Gave Thanks to 14th For This Post:
 

10 More Discussions You Might Find Interesting

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

2. UNIX for Dummies Questions & Answers

Perl - converting selected characters to upper/lower case

Using STDIN, how can I use perl to take an input string, with all lower case letters in the first five characters, and convert them to uppercase... then take all uppercase letters in the second five characters and convert them to lowercase. Example: MichaelSmith to michaELSMIth Thank you! (2 Replies)
Discussion started by: doubleminus
2 Replies

3. Shell Programming and Scripting

how to convert value in a variable from upper case to lower case

Hi, I have a variable $Ctrcd which contains country names in upper case and i want to convert them into lower case. I have tried so many solutions from already existing threads but couldn't get the correct one. Can anybody help me with this..... Thanks a lot.. (2 Replies)
Discussion started by: manmeet
2 Replies

4. Shell Programming and Scripting

convert upper case to lower case in ascript

I have a package to install and the installation script which does it . The files/directories names in the script are all lower case but the actual package has everything in upper case - file names, directories . I don't want to rename directories and files in the package - it has a lot of them . ... (2 Replies)
Discussion started by: vz6zz8
2 Replies

5. Shell Programming and Scripting

Script to Convert Upper case to Lower case

Hi All I have a script which extracts values from a Database (A persons name) and puts it into a variable in my script IE: $NAME However the Value in the DB is all in uppercase and contains the users first name and last name EG: > echo $NAME GRAHAM BOYLE > What I need is only the... (7 Replies)
Discussion started by: grahambo2005
7 Replies

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

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

8. Shell Programming and Scripting

Conversion from Upper Case to Lower Case Condition based

Hello Unix Gurus : It would be really appreciative if can find a solution for this . I have records in a file . I need to Capitalize the records based on condition . For Example i tried the following Command COMMAND --> fgrep "2000YUYU" /export/home/oracle/TST/data.dat | tr '' ''... (12 Replies)
Discussion started by: tsbiju
12 Replies

9. UNIX for Dummies Questions & Answers

To convert Lower case to Upper Case

There is a script where we pass the parameter in lower case: say: . ./scriptName pArameter #!/bin/ksh echo "`date` Entering $0 Reloading the $1 table " mname1=$1 (code to login MYSQL Database) Truncate table $mname1; exit ! Since now there is a limitaion of MYSQL that it accept... (5 Replies)
Discussion started by: ambarginni
5 Replies

10. 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
ALTER FOREIGN 
TABLE(7) PostgreSQL 9.2.7 Documentation ALTER FOREIGN TABLE(7) NAME
ALTER_FOREIGN_TABLE - change the definition of a foreign table SYNOPSIS
ALTER FOREIGN TABLE [ IF EXISTS ] name action [, ... ] ALTER FOREIGN TABLE [ IF EXISTS ] name RENAME [ COLUMN ] column_name TO new_column_name ALTER FOREIGN TABLE [ IF EXISTS ] name RENAME TO new_name ALTER FOREIGN TABLE [ IF EXISTS ] name SET SCHEMA new_schema where action is one of: ADD [ COLUMN ] column_name data_type [ NULL | NOT NULL ] DROP [ COLUMN ] [ IF EXISTS ] column_name [ RESTRICT | CASCADE ] ALTER [ COLUMN ] column_name [ SET DATA ] TYPE data_type ALTER [ COLUMN ] column_name { SET | DROP } NOT NULL ALTER [ COLUMN ] column_name SET STATISTICS integer ALTER [ COLUMN ] column_name SET ( attribute_option = value [, ... ] ) ALTER [ COLUMN ] column_name RESET ( attribute_option [, ... ] ) ALTER [ COLUMN ] column_name OPTIONS ( [ ADD | SET | DROP ] option ['value'] [, ... ]) OWNER TO new_owner OPTIONS ( [ ADD | SET | DROP ] option ['value'] [, ... ]) DESCRIPTION
ALTER FOREIGN TABLE changes the definition of an existing foreign table. There are several subforms: ADD COLUMN This form adds a new column to the foreign table, using the same syntax as CREATE FOREIGN TABLE (CREATE_FOREIGN_TABLE(7)). DROP COLUMN [ IF EXISTS ] This form drops a column from a foreign table. You will need to say CASCADE if anything outside the table depends on the column; for example, views. If IF EXISTS is specified and the column does not exist, no error is thrown. In this case a notice is issued instead. IF EXISTS Do not throw an error if the foreign table does not exist. A notice is issued in this case. SET DATA TYPE This form changes the type of a column of a foreign table. SET/DROP NOT NULL Mark a column as allowing, or not allowing, null values. SET STATISTICS This form sets the per-column statistics-gathering target for subsequent ANALYZE(7) operations. See the similar form of ALTER TABLE (ALTER_TABLE(7)) for more details. SET ( attribute_option = value [, ... ] ), RESET ( attribute_option [, ... ] ) This form sets or resets per-attribute options. See the similar form of ALTER TABLE (ALTER_TABLE(7)) for more details. OWNER This form changes the owner of the foreign table to the specified user. RENAME The RENAME forms change the name of a foreign table or the name of an individual column in a foreign table. SET SCHEMA This form moves the foreign table into another schema. OPTIONS ( [ ADD | SET | DROP ] option ['value'] [, ... ] ) Change options for the foreign table or one of its columns. ADD, SET, and DROP specify the action to be performed. ADD is assumed if no operation is explicitly specified. Duplicate option names are not allowed (although it's OK for a table option and a column option to have the same name). Option names and values are also validated using the foreign data wrapper library. All the actions except RENAME and SET SCHEMA can be combined into a list of multiple alterations to apply in parallel. For example, it is possible to add several columns and/or alter the type of several columns in a single command. You must own the table to use ALTER FOREIGN TABLE. To change the schema of a foreign table, you must also have CREATE privilege on the new schema. To alter the owner, you must also be a direct or indirect member of the new owning role, and that role must have CREATE privilege on the table's schema. (These restrictions enforce that altering the owner doesn't do anything you couldn't do by dropping and recreating the table. However, a superuser can alter ownership of any table anyway.) To add a column or alter a column type, you must also have USAGE privilege on the data type. PARAMETERS
name The name (possibly schema-qualified) of an existing foreign table to alter. column_name Name of a new or existing column. new_column_name New name for an existing column. new_name New name for the table. data_type Data type of the new column, or new data type for an existing column. CASCADE Automatically drop objects that depend on the dropped column (for example, views referencing the column). RESTRICT Refuse to drop the column if there are any dependent objects. This is the default behavior. new_owner The user name of the new owner of the table. new_schema The name of the schema to which the table will be moved. NOTES
The key word COLUMN is noise and can be omitted. Consistency with the foreign server is not checked when a column is added or removed with ADD COLUMN or DROP COLUMN, a NOT NULL constraint is added, or a column type is changed with SET DATA TYPE. It is the user's responsibility to ensure that the table definition matches the remote side. Refer to CREATE FOREIGN TABLE (CREATE_FOREIGN_TABLE(7)) for a further description of valid parameters. EXAMPLES
To mark a column as not-null: ALTER FOREIGN TABLE distributors ALTER COLUMN street SET NOT NULL; To change options of a foreign table: ALTER FOREIGN TABLE myschema.distributors OPTIONS (ADD opt1 'value', SET opt2, 'value2', DROP opt3 'value3'); COMPATIBILITY
The forms ADD, DROP, and SET DATA TYPE conform with the SQL standard. The other forms are PostgreSQL extensions of the SQL standard. Also, the ability to specify more than one manipulation in a single ALTER FOREIGN TABLE command is an extension. ALTER FOREIGN TABLE DROP COLUMN can be used to drop the only column of a foreign table, leaving a zero-column table. This is an extension of SQL, which disallows zero-column foreign tables. PostgreSQL 9.2.7 2014-02-17 ALTER FOREIGN TABLE(7)
All times are GMT -4. The time now is 01:09 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy