[SOLVED] Ignore case only for part of regular expression
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
First, it appears to be looking for any number of "tab" or space characters in several places. Is that relevant to your problem?
Second the "I" or "i" at the end of the s command makes it case-INsensistive, but just for the s command. This is a Gnu extension, which I found here: http://www.gnu.org/software/sed/manual/sed.html
Regardless of the spaces and tabs, it's finding lower case "x", and then doing the substitution on "y" or "Y".
First, it appears to be looking for any number of "tab" or space characters in several places. Is that relevant to your problem?
Second the "I" or "i" at the end of the s command makes it case-INsensistive, but just for the s command. This is a Gnu extension, which I found here: http://www.gnu.org/software/sed/manual/sed.html
Regardless of the spaces and tabs, it's finding lower case "x", and then doing the substitution on "y" or "Y".
The "tabs" and "spaces" are very much relevant and I think it's working exactly as expected.
The problem I had was regarding, yp.conf
domain <domainname> server <servername>
entries
The domain in NIS is case sensitive but the servername is case insensitive.
I had to write a script to find and modify server name for a particular domain
So, I had to look for case-sensitive <domainname> and then replace all occurrences of <servername> with the new server.
The x in my sed command denotes the domainname and y/Y is for server
I think i know how to do this with the -P switch with grep (P standing for Perl syntax). For that you should be able to specify things like [a-z]\x20[a-zA-z] THe first thing in braces will just match lowercase a-z, the middle is a space, and the next matches a character that's either upper or lower case.
I hope this helps you out. This is all assuming you're using grep I guess, I'm uncertain what tool you have so I can't give more help unless I know that.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.