LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
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 07-05-2011, 07:14 AM   #1
sebelk
Member
 
Registered: Jan 2007
Posts: 66

Rep: Reputation: 15
matching not working as expected...


Hi,

I have the file /tmp/qqq that contains:

Code:
2
5
232323
A
If I issue:

Code:
sed   /[0-9]\{3\}/p  /tmp/qqq
It prints all lines

I don't know why because if I run:

Code:
egrep [0-9]{3} /tmp/qqq
It outputs only:

Code:
232323

I tried even with and without quoting or even with and with without "\" or even using "-r". OK in this little example I could use egrep but I am trying to do something more complex and sed would be useful if it worked as I (perhaps wrong) expected

Could you help me?
 
Old 07-05-2011, 07:17 AM   #2
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
Hi,

Code:
sed -n '/[0-9]\{3\}/p' /tmp/qqq
Hope this helps.
 
1 members found this post helpful.
  


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
[SOLVED] >> not working as expected MartenH Linux - Newbie 5 08-22-2010 10:35 AM
any character matching doesn't yield expected result in PERL gaynut Programming 4 09-26-2008 01:04 AM
ln command not working as expected walterbyrd Linux - Software 3 01-04-2008 01:51 PM
Useradd - not working as expected Paean Solaris / OpenSolaris 13 01-31-2006 04:06 PM
chmod u+s not working as expected clinton Linux - Newbie 3 03-19-2004 07:49 PM

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

All times are GMT -5. The time now is 08:11 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