sed ignoring case for search but respecting case for subtitute


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting sed ignoring case for search but respecting case for subtitute
# 1  
Old 09-02-2010
sed ignoring case for search but respecting case for subtitute

Hi
I want to make string substitution ignoring case for search but respecting case for subtitute. Ex changing all occurences of "original" in a file to "substitute":
original becomes substitute
Origninal becomes Substitute
ORIGINAL becomes SUBSTITUTE

I know this a little special but it's not the first time I need such a function and did not find a simple sed or awk flag for that.

Thanks for your help
# 2  
Old 09-02-2010
There is no sed flag to do such a substitution. You just have to do three search and substitute operations.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Remove duplicate lines after ignoring case and spaces between

Oracle Linux 6.5 $ cat someStrings.txt GRANT select on MANHPRD.S_PROD_INT TO OR_PHIL; GRANT select on MANHPRD.S_PROD_INT TO OR_PHIL; GRANT select on SCOTT.emp to JOHN; grant select on scott.emp to john; grant select on scott.dept to hr;If you ignore the case and the empty space between the... (6 Replies)
Discussion started by: kraljic
6 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

ignoring case

in if clause , how 1 can ignore case (i.e. small or capital) ny suggestions? (2 Replies)
Discussion started by: Gl@)!aTor
2 Replies

4. UNIX for Dummies Questions & Answers

Using sed for case insensitive search

Hi, I have a file named "test_file" that has the below content. It has words in upper/lower cases PRODOPS prodOPS ProdOps PRODops escalate Shell My requirement is to replace all the "prodops" (what ever case it may be) with "productionoperations". I tried using the "i" option with... (7 Replies)
Discussion started by: sbhuvana20
7 Replies

5. Shell Programming and Scripting

Ignoring file name case and decrypting it.

Dear Friends, I want to decrypt 2 different file types in a folder (ZIP files and GPG files). Each file type need different decryption syntex. Hence, the script should identify file type and should act accordingly ignoring file name case i.e. upper or lower case. Also, the extention can be... (6 Replies)
Discussion started by: anushree.a
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

Ignoring case in sed search

I am getting a parameter from a user and I need to use it to search and return the matching line numbers in a file. I am using this code: recordNumber="$(sed -n '/'"$entry"'/{ = d }' unixdb1.txt)" where $entry is the passed search parameter. The problem is I need to ignore the case. ... (3 Replies)
Discussion started by: snag49ers
3 Replies

8. Shell Programming and Scripting

Script needed to select and delete lower case and mixed case records

HELLO ALL, URGENTLY NEEDED A SCRIPT TO SELECT AND DELETE LOWER AND MIXED CASE RECORDS FROM A COLUMN IN A TABLE. FOR EXAMPLE : Table name is EMPLOYEE and the column name is CITY and the CITY column records will be: Newyork washington ... (1 Reply)
Discussion started by: abhilash mn
1 Replies

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