LINUX.IE, website of the Irish Linux Users' Group
Tux rules!

   
Home
New Users
Articles
Download
Projects
Community
Vendors

  Print Version
Email to...
 
Archives:


planetILUG

Recent News

News Archive


Join the
ILUG
on FaceBook


Join the
ILUG
on LinkedIn


Join the
ILUG SETI
Group



















 
 :: Mailing Lists

[ILUG] regular expression question

[ILUG] regular expression question

Mark McLoughlin mark at skynet.ie
Tue Nov 13 16:53:38 GMT 2001


Hi Padraig,

On Tue, 13 Nov 2001, Padraig Brady wrote:

> [padraig at pixelbeat findul]$ cat input.txt
> /lib/libthread_db-1.0.so
> /usr/lib/gphoto/libgphoto_canon.so.0
> /usr/lib/lib_alchemistmodule.so
>
>
> OK I want to only show files in /lib/ or /usr/lib/
> so I'm trying to exclude lines that have a / after
> these 2 strings.
> So try 1: Match 1 or more characters not /
>
> [padraig at pixelbeat findul]$ cat input.txt |
> grep "\(^/usr/lib/[^/]+$\|^/lib/\)"
> /lib/libthread_db-1.0.so
>
> This didn't match the last entry, why?

	Strange indeed. Interestingly

grep "\(^/usr/lib/[^/][^/]*$\|^/lib/\)" < input.txt

	works. So it may be a bug ?

	Out of curiousity - how come you didn't try something like

grep "^/\(usr/lib$\|^lib\)/[^/]+$" < input.txt

Good Luck,
Mark.





More information about the ILUG mailing list
Read this without the formatting.
                                                                                                    

 

Hosted by HEAnet


Maintained by the ILUG website team. The aim of Linux.ie is to support and help commercial and private users of Linux in Ireland. You can display ILUG news in your own webpages, read backend information to find out how. Networking services kindly provided by HEAnet, server kindly donated by Dell. Linux is a trademark of Linus Torvalds, used with permission. No penguins were harmed in the production or maintenance of this highly praised website. Looking for the Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!
RSS Version
Powered by Dell