How to make sed case insensitive


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to make sed case insensitive
# 1  
Old 01-06-2009
How to make sed case insensitive

I need to remove a pattern say, ABCD whether it is in uppercase or lowercase from a string. How to do it using SED?
for example
ABCDEF should output to EF
abcdEF should also output to EF
# 2  
Old 01-06-2009
Hi,

Code:
sed 's/ABCD//i' file

Should do it.

HTH Chris
# 3  
Old 01-06-2009
sed 's/[Aa][Bb][Cc][Dd]\(..\)/\1/' file
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Making SED case insensitive

Dears, In the below string, please let me know how to make the sed search case-incensitive. I have more such lines in my script instead of let me know any other easier option. sed -n '/dn: MSISDN=/,/^\s*$/p' full.ldif > temp ; sed -n... (4 Replies)
Discussion started by: Kamesh G
4 Replies

2. Shell Programming and Scripting

Use case insensitive variable in ksh shell scripting using sed or awk

I am using a variable called $variable in a pattern search to print from a starting variable to a constant value. the variable search should be case in sensitive. i tired using Ip at the end in the below command. but in ksh it is not working. sed -n "/$variable/,/constant/p" file i also... (11 Replies)
Discussion started by: johnjs
11 Replies

3. Shell Programming and Scripting

making sed command case insensitive

i have something like this in a file cat onlytables.sql create table NextID ( id int auto_increment, zoneID int, entityName varchar(64), nextID int, lastModified TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, primary... (6 Replies)
Discussion started by: vivek d r
6 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

Case Insensitive search

Hey , i am trying to do a search for the certain books , and im trying to make it case insensitive. what i have come up with so far is this : Database.txt RETARDED MONKEY:RACHEAL ABRAHAML:30:30:20 GOLD:FATIN:23.20:12:3 STUPID:JERLYN:20:40:3 echo -n "Title: " read Title echo -n... (3 Replies)
Discussion started by: gregarion
3 Replies

6. Shell Programming and Scripting

case-insensitive if on substring

I'd like to print a line if a substring is matched in a case insensitive manner something like do a case insensitive search for ABCD as a substring: awk '{ if (substr($1,1,4) == "") print $1 }' infile > outfile I'm not certain how to make the syntax work??? Thanks (4 Replies)
Discussion started by: dcfargo
4 Replies

7. UNIX for Dummies Questions & Answers

How to make URLs/FileNames case insensitive in Linux Hosting environment

Hi, Currently my website is hosted on Linux-Apache environment. If I try to access a file on a website named "Read.txt" as http://xyz.com/READ.txt, I get an error message "Page Not Found". Only way to access is http://xyz.com/Read.txt. How do I make URLS (File Names and Folder Names)... (1 Reply)
Discussion started by: naidu545
1 Replies

8. Shell Programming and Scripting

case insensitive

hi everyone, I need to do the following thing in a case insesitive mode sed 's/work/job/g' filename since work could appear in different form as Work WORK WorK wORK,.... I was wondering if i could do a case insensitive search of a word. thanks in advance, :) (4 Replies)
Discussion started by: ROOZ
4 Replies

9. Shell Programming and Scripting

how to make case insensitive checks????

Hi, I have tried to make the conditions similar to the below one's, perhaps, I am not sure if there are any more way's to do that???? if ) ]] echo "Whatever" fi (5 Replies)
Discussion started by: hitmansilentass
5 Replies

10. Shell Programming and Scripting

awk case-insensitive

can I tell awk to be case insensitive for one operation without setting the ignorecase value ? thanks, Steffen (7 Replies)
Discussion started by: forever_49ers
7 Replies
Login or Register to Ask a Question