using the perl version of the find command...


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting using the perl version of the find command...
# 1  
Old 03-31-2005
using the perl version of the find command...

hi,
i am looking through the perl documentation in the man pages for the first time but I have looked at some other reference giudes before (at a glance) and remember that there is a find command used by perl can any one give me a structured example of that command and how it works and if possible were to look for reference to this type of command construct...
moxxx68..
# 2  
Old 03-31-2005
There is no intrinsic Perl function that allows you to do a file search like the shell "find" command. With the core functions, the most you can get is to call the opendir() and readdir() functions recursively and use regular expression to carry out the search (or use stat() to search for file attributes).

Newer Perls does ship with a File::Find module though, it's already the closest match I can find, but actually not quite similar, and not as versatile/flexible as the shell "find" command. It may be what you are looking for, but may be not. This is a module, not an intrinsic command, or function.

On the CPAN there is also the File::Find::Rule module, seems to be a bit more versatile though, but you need to install it yourself before use. There are also a handful lots of other modules for file searching on the CPAN. If you have time, you can also dig out some from

http://search.cpan.org/search?query=...ARule&mode=all

I have not used any of these modules before so I am unable to give you an example. You may find a few examples with some googling though.
# 3  
Old 03-31-2005
great....!
thanx moxxx68.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Perl find command tweak

i use the following command to find files that were recently updated within the last hour: perl -MFile::Find -le' find { wanted => sub { -f and 3600 / 86400 >= -M and print $File::Find::name; } }, shift' /var/app/mydata/ this command works well. however, it seems to also search directories... (1 Reply)
Discussion started by: SkySmart
1 Replies

2. Shell Programming and Scripting

How find Linux version from command line?

Hi, I am looking to extract linux version from /etc/*-release file. I am specifically tring to avoid use of awk command here. would be great if can do done via sed or grep command. Red Hat Enterprise Linux Server release 6.5 (Tikanga) output must be 6 regards, Litu (7 Replies)
Discussion started by: Litu1988
7 Replies

3. Shell Programming and Scripting

Perl-OS command to find out what kind

I need to know a command to find out which version of Perl Im currently running. Thanks Ben (2 Replies)
Discussion started by: bigben1220
2 Replies

4. Shell Programming and Scripting

How to find which perl modules version is used?

Hi All, I am rather new to the world of Perl programming. I have a question regarding the perl modules. I have a linux box running slackware 12.2 and has perl installed by default there (version 5.10.0) and it has several modules installed namely DBI and DBD::mysql that I wanted to upgrade. ... (2 Replies)
Discussion started by: aherrys
2 Replies

5. UNIX for Dummies Questions & Answers

how to use sed or perl command to find and replace a directory in a file

how to use sed command to find and replace a directory i have a file.. which contains lot of paths ... for eg.. file contains.. /usr/kk/rr/12345/1 /usr/kk/rr/12345/2 /usr/kk/rr/12345/3 /usr/kk/rr/12345/4 /usr/kk/rr/12345/5 /usr/kk/rr/12345/6 /usr/kk/rr/12345/7... (1 Reply)
Discussion started by: wip_vasikaran
1 Replies

6. Shell Programming and Scripting

Perl Script Error with find command

Guys, I need to find all the files ending with either dmp or dmp.Z. This command is giving me error. @files =`find $path \(-name "*.dmp" -o -name "*.dmp.Z"\) -mtime +30`; sh: 0403-057 Syntax error at line 1 : `(' is not expected. Thanks in advance (4 Replies)
Discussion started by: MKNENI
4 Replies

7. Shell Programming and Scripting

unix command to find the version of Informix database

Hi All Please let me know if there is command to check the version of the informix database installed..? Thanks in advance. Suresh (4 Replies)
Discussion started by: sureshg_sampat
4 Replies

8. UNIX for Dummies Questions & Answers

Find Software Version

Hi, Is there anyway to find what version of a software is installed on a particular box ? For Tru64 unix, the setld -i command lists all the software that is installed. But how do i get the version ? is there a unix command for this? Is setld specific to Tru64 ? Do reply VJ (1 Reply)
Discussion started by: vjsony
1 Replies

9. UNIX for Dummies Questions & Answers

How do I find out what version of X I'm using?

How can I find out? Besides looking on the box of my distro and checking their. (2 Replies)
Discussion started by: DISTURBED
2 Replies

10. UNIX for Dummies Questions & Answers

How do I find Unix Version

I am extremely new here. Someone wants to upgrade off of Unix to Windows 2000 and wants to know if they need to buy new hardware How do I find out what type of Unix they're using? How do I find out the current hardware of the system? (Intel, ..etc) Thanks (3 Replies)
Discussion started by: tomsha
3 Replies
Login or Register to Ask a Question