?
Solved

Case Insensitive Grep Search

Posted on 2003-03-14
2
Medium Priority
?
210 Views
Last Modified: 2013-12-25
Hello,

I have the following piece of code to search an array for a user specified value:
@packages = grep /$value/, @array;

However, the search is case sensitive, so I tried adding the -i flag for grep:
@packages = grep -i /$value/, @array;

Unfortunately this causes the code compilation to fail, giving me the following error message:

"Software error:
Unrecognized file test: -i at [file name, line number]"

Am I using the -i flag wrong?  Or is there another way to do this?
Any help would be greatly appreciated.  Thanks in advance.
0
Comment
Question by:_Dan_
2 Comments
 
LVL 17

Accepted Solution

by:
dorward earned 200 total points
ID: 8136873
Try:
@packages = grep /$value/i, @array;

I _think_ that will do the trick.
0
 

Author Comment

by:_Dan_
ID: 8136904
Perfect!  Thanks a lot.
0

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I hope you'll find this tutorial useful and interesting. So let's try to extend Tcl with a new package.  For anyone more deeply interested please check out the book "Practical Programming in Tcl and Tk". It's really one of the best written books abo…
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
Learn the basics of strings in Python: declaration, operations, indices, and slicing. Strings are declared with quotations; for example: s = "string": Strings are immutable.: Strings may be concatenated or multiplied using the addition and multiplic…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
Suggested Courses

621 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question