LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This 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


Reply
  Search this Thread
Old 04-10-2007, 10:26 AM   #1
zybot5785
LQ Newbie
 
Registered: Apr 2007
Posts: 5

Rep: Reputation: 0
Quick Question


I'm writing a script in php and using server side code. I'm using the egrep command, so far I have egrep -i so it wont be case sensitive. My problem is that my users will more than likely be entering - and : in their searches and it will turn up with nothing. I need to exclude all characters from searches except the letters G-P and the numbers 0-9, the maximum I want them to be able to search for is 6 characers any idea how to do this with the egrep command and only come up with one result?
 
Old 04-10-2007, 11:11 AM   #2
zybot5785
LQ Newbie
 
Registered: Apr 2007
Posts: 5

Original Poster
Rep: Reputation: 0
I'm guessing I'll have to use the oct or sed command's to filter it first, then the egrep / grep command.

Not really sure what the command should be though.
 
Old 04-10-2007, 12:28 PM   #3
zybot5785
LQ Newbie
 
Registered: Apr 2007
Posts: 5

Original Poster
Rep: Reputation: 0
Alright, I was able to get it to do what I wanted w/ a script.

grep $(echo "ab-c:de:f" | sed -e "s/[^0-9a-zA-Z]//g") filename.txt

now, if anyone knows how to make php do this, I'd appreciate it
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
quick question 0aniel Programming 17 02-13-2006 11:59 PM
quick question toy_soldier123 SUSE / openSUSE 12 01-31-2005 05:43 PM
Question Concerning ISO's and one quick question. evrae Linux - Software 2 06-21-2004 04:53 AM
Quick c++ question genesis12 Programming 3 03-21-2004 06:35 PM
samba smb.config question (quick question) TheDOGG Linux - Networking 1 03-02-2004 08:19 AM


All times are GMT -5. The time now is 01:22 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration