LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 09-02-2005, 09:15 AM   #1
mdarby
Member
 
Registered: Nov 2004
Location: Columbus, Ohio
Distribution: Slackware-Current / Debian
Posts: 795

Rep: Reputation: 30
Regular Expression oddity


I'm using a regular expression to find all *.<digit> and *.gz files in a directory. Normally something like this works, but I'm missing something...

When I run this:
Code:
find /var/log/ -iregex ".*\.\(\d\|gz\)$"
I get in return:
Code:
/var/log/setuid.changes.1.gz
/var/log/syslog.1.gz
Here is /var/log:
Code:
drwx------    2 root     root         4.0k Jun 23 11:15 afick/
-rw-r-----    1 root     adm          8.7M Sep  2 10:10 auth.log
-rw-r-----    1 root     adm           13M Aug 28 06:47 auth.log.0
drwxr-xr-x    2 root     staff        4.0k Sep  2 06:44 cups/
-rw-r-----    1 root     adm          438k Sep  2 10:10 daemon.log
-rw-r-----    1 root     adm          595k Aug 28 06:46 daemon.log.0
-rw-r-----    1 root     adm             0 Jul 17 06:47 debug
-rw-r-----    1 root     adm           356 Jul 16 23:10 debug.0
-rw-r--r--    1 root     root         7.4k Jul 16 23:10 dmesg
drwxr-xr-x    2 exim     exim         4.0k Oct 28  2004 exim/
-rw-r--r--    1 root     root          50k Aug 31 16:37 faillog
-rw-r-----    1 root     adm          2.2k Sep  1 20:52 kern.log
-rw-r-----    1 root     adm          2.0k Aug 26 20:34 kern.log.0
drwxr-xr-x    2 root     root         4.0k Sep  2 06:25 ksymoops/
-rw-rw-r--    1 root     utmp         613k Sep  2 09:58 lastlog
-rw-r--r--    1 root     root            0 Nov  5  2004 lpr.log
drwxrws---    2 root     smmsp        4.0k Sep  1 12:00 mail/
lrwxrwxrwx    1 root     root           22 Aug 18 14:08 mail.log -> /var/log/mail/mail.log
-rw-r-----    1 root     adm           15k Sep  2 10:02 messages
-rw-r-----    1 root     adm           19k Aug 28 06:39 messages.0
drwxr-sr-x    3 news     news         4.0k Nov  5  2004 news/
drwxrwxr-x    2 root     root         4.0k Sep 25  2002 sa/
-rw-r-----    1 root     adm           329 Sep  2 06:31 setuid.changes
-rw-r-----    1 root     adm           329 Sep  1 06:31 setuid.changes.0
-rw-r-----    1 root     adm            37 Aug 31 06:25 setuid.changes.1.gz
-rw-r-----    1 root     adm          3.3M Sep  2 06:31 setuid.today
-rw-r-----    1 root     adm          3.3M Sep  1 06:31 setuid.yesterday
-rw-r-----    1 root     adm           46k Sep  2 10:10 syslog
-rw-r-----    1 root     adm          300k Sep  2 06:30 syslog.0
-rw-r-----    1 root     adm           32k Sep  1 06:30 syslog.1.gz
-rw-r-----    1 root     adm             0 Aug 28 06:47 user.log
-rw-r-----    1 root     adm           147 Aug 24 10:46 user.log.0
-rw-r--r--    1 root     root            0 Nov  5  2004 uucp.log
drwxr-xr-x    2 root     root         4.0k Jun 15 18:45 vasambashield/
-rw-------    1 root     root          21M Sep  2 10:10 vsftpd.log
-rw-rw-r--    1 root     utmp         4.8M Sep  2 09:58 wtmp
-rw-r-----    1 root     adm             0 Sep  1 06:52 xferlog
-rw-r-----    1 root     adm             0 Aug  1 06:52 xferlog.0
-rw-r-----    1 root     adm             0 Sep  1 06:52 xferreport
-rw-r-----    1 root     adm             0 Aug  1 06:52 xferreport.0
drwxr-xr-x    2 nobody   nogroup      4.0k Aug 29  2001 xfs-xtt/
drwxr-xr-x    2 zabbix   zabbix       4.0k Jun 23 16:34 zabbix/
Why wouldn't (for example) syslog.0 or user.log.0 be returned?
 
Old 09-02-2005, 09:32 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,

\d is not supported in find. Change \d to [0-9] and it works.

Hope this helps.
 
Old 09-02-2005, 09:37 AM   #3
mdarby
Member
 
Registered: Nov 2004
Location: Columbus, Ohio
Distribution: Slackware-Current / Debian
Posts: 795

Original Poster
Rep: Reputation: 30
Ugh, I'm an idiot. It was the above problem and the fact that I was searching for files ending in 1-9. All of the files ending with a digit ended in "0".

Thanks for your help!

Last edited by mdarby; 09-02-2005 at 09:39 AM.
 
  


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
Need help with regular expression aecaudel Programming 6 11-04-2005 05:28 AM
Need help with Regular Expression subaruwrx Linux - Newbie 6 09-04-2004 07:48 PM
Regular Expression Help WeNdeL Linux - General 1 08-14-2003 10:08 AM
Regular Expression slizadel Programming 4 07-28-2003 05:16 AM
regular expression gumby Programming 3 07-15-2003 12:13 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 04:38 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
Open Source Consulting | Domain Registration