Solved

find and perl

Posted on 2009-07-14
1
322 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

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
netstat -a in AIX unix 8 51
ftpcommand 2 73
Remote Change Dates on AIX Automation 7 72
Field name with special character (Ñ) in Oracle 11 129
Using libpcap/Jpcap to capture and send packets on Solaris version (10/11) Library used: 1.      Libpcap (http://www.tcpdump.org) Version 1.2 2.      Jpcap(http://netresearch.ics.uci.edu/kfujii/Jpcap/doc/index.html) Version 0.6 Prerequisite: 1.      GCC …
Every server (virtual or physical) needs a console: and the console can be provided through hardware directly connected, software for remote connections, local connections, through a KVM, etc. This document explains the different types of consol…
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 get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…

679 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