LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 06-07-2015, 02:01 PM   #16
joec@home
Member
 
Registered: Sep 2009
Location: Galveston Tx
Posts: 291

Rep: Reputation: 70

For specific regex functions, you might want to take a look at http://www.regexr.com/ It has a live example to help code on the fly.
 
Old 06-07-2015, 03:57 PM   #17
rbees
Member
 
Registered: Mar 2004
Location: northern michigan usa
Distribution: Debian Squeeze, Whezzy, Jessie
Posts: 921

Original Poster
Rep: Reputation: 46
Thanks rknichols

I had completely missed that the "." was still in the command. After removing it grep is returning what it did before.

Also I want "only" the words that have the antiquated word endings "est" or "eth" as in becamest or accepteth, so adding the \w at the end gets me words I don't want and so I removed it from the example I started from.

Thanks joec@home I will take a good look at the regexr site. Looks to be very useful.

So there is not a grep bug after all. And what's more the command as originally posted works as it should as near as I can tell. Of coarse I do run Debian Testing and I don't always restart after updates so maybe grep was using mismatched libraries or something.
 
Old 06-07-2015, 04:03 PM   #18
joec@home
Member
 
Registered: Sep 2009
Location: Galveston Tx
Posts: 291

Rep: Reputation: 70
With more advanced commands with regex and so on, I tend to experiment switching between grep and egrep to see which works better in what situation.
 
Old 06-07-2015, 07:29 PM   #19
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,776

Rep: Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212
Quote:
Originally Posted by rbees View Post
Thanks rknichols

I had completely missed that the "." was still in the command. After removing it grep is returning what it did before.

Also I want "only" the words that have the antiquated word endings "est" or "eth" as in becamest or accepteth, so adding the \w at the end gets me words I don't want and so I removed it from the example I started from.
Then, you might want "\b" following the "est" to require the word to end at that point and not match partial words that have "est" somewhere in the middle. Or, perhaps you aren't seeing enough of those false matches to matter.
 
  


Reply



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
[SOLVED] how to use grep to search for words/sentences starting with hyphen? aswani Programming 12 09-01-2012 07:44 AM
Can I use grep to find two words near each other? walterbyrd Linux - Software 4 12-09-2011 11:01 PM
how to grep 2 words at the same time ufmale Linux - Newbie 2 09-09-2010 04:25 PM
[SOLVED] LQ Search: Can there be a way to search for tiny words? GrapefruiTgirl LQ Suggestions & Feedback 6 02-02-2010 05:58 PM
Search and Replace: Asian Words to English Words ieeestd802 Linux - Software 0 10-27-2004 07:48 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:50 PM.

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
Open Source Consulting | Domain Registration