Help answer threads with 0 replies.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 10-24-2010, 11:44 AM   #1
LQ Newbie
Registered: Oct 2010
Posts: 7

Rep: Reputation: 0
Question Help with sed regex to match words via a pattern.

Hello everyone!

I have some lines of text and I want to detect words that meet some criteria with sed.

E.g. The line "tetris cat dog test cactus stereotype"

I want to detect the word that contains two (2) ore more t letters. That mean the words tetris, test and stereotype.

The following regex doesn't do the job because it can;t distinguish words very well.


I thinks I have ti incorporate something like [^ ] in the regex but I wasn't successful...

Any help?
Old 10-24-2010, 11:59 AM   #2
LQ Newbie
Registered: Oct 2010
Distribution: Redhat
Posts: 24

Rep: Reputation: -3
I am not sure but why dont you try this::
a [a-zA-z0-9]
{a}*[t]{a}*[t]{a}* {printf("valid ");}
Old 10-24-2010, 03:14 PM   #3
LQ Newbie
Registered: Oct 2010
Posts: 7

Original Poster
Rep: Reputation: 0
No, unfortunately it doesn't work. Anyone else?
Old 10-24-2010, 04:33 PM   #4
LQ Newbie
Registered: Oct 2010
Posts: 7

Original Poster
Rep: Reputation: 0
Ok, I found the regex.

[ ]*[^ ]*t[^ ]*t[^ ]*


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
How to use sed to delete all lines before the first match of a pattern? C_Blade Linux - Newbie 9 05-01-2010 04:18 AM
printing pattern match and not whole line that matches pattern Avatar33 Programming 13 05-06-2009 06:17 AM
simple pattern match with awk, sed alenD Linux - Newbie 10 03-10-2008 02:31 PM
sed display line after pattern match inonzi_prowler Linux - Software 3 02-19-2007 01:47 PM
how to use the sed w option to redirect pattern match to file nickleus Linux - General 11 04-18-2006 08:34 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:26 AM.

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