Solved

find and perl

Posted on 2009-07-14
1
318 Views
Last Modified: 2012-05-07
Hello,
I am using find2perl for finding files with no UIDs.

#! /usr/opt/perl5/bin/perl -w
eval 'exec /usr/opt/perl5/bin/perl -S $0 ${1+"$@"}'
if 0; #$running_under_some_shell

use strict;
use File::Find ();

# Set the variable $File::Find::dont_use_nlink if you're using AFS,
# since AFS cheats.

# for the convenience of &wanted calls, including -eval statements:
use vars qw/*name *dir *prune/;
*name = *File::Find::name;
*dir = *File::Find::dir;
*prune = *File::Find::prune;

sub wanted;


my (%uid, %user);
while (my ($name, $pw, $uid) = getpwent) {
$uid{$name} = $uid{$uid} = $uid;
}


# Traverse desired filesystems
File::Find::find({wanted => \&wanted}, '/');
exit;


sub wanted {
my ($dev,$ino,$mode,$nlink,$uid,$gid);

(
(($dev,$ino,$mode,$nlink,$uid,$gid) = lstat($_)) &&
($dev >= 0)
||
($dev >= 0)
) &&
!exists $uid{$uid} &&
print("$name\n");
}

Can someone help in fixing the following errors.
Use of uninitialized value in numeric ge (>=) at ./find_owner_script.pl line 35.
Use of uninitialized value in exists at ./find_owner_script.pl line 35.

Also I would like to exclude proc from the search.

Thanks.
0
Comment
Question by:Legatie
1 Comment
 
LVL 84

Accepted Solution

by:
ozo earned 500 total points
ID: 24852292

(($dev,$ino,$mode,$nlink,$uid,$gid) = lstat($_)) &&
($dev >= 0)
 &&
!exists $uid{$uid} &&
print("$name\n");
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Host issue and need to move VM's 2 242
How to find files recursively in ftp server quickly? 7 101
Skill Development 15 163
unix example issues 18 75
When you do backups in the Solaris Operating System, the file system must be inactive. Otherwise, the output may be inconsistent. A file system is inactive when it's unmounted or it's write-locked by the operating system. Although the fssnap utility…
Introduction Regular patching is part of a system administrator's tasks. However, many patches require that the system be in single-user mode before they can be installed. A cluster patch in particular can take quite a while to apply if the machine…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now