<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Perl and find command in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/perl-and-find-command/m-p/4459533#M679956</link>
    <description>Hi Robert:&lt;BR /&gt;&lt;BR /&gt;Why are you adding Perl to what you can't do in a shell?&lt;BR /&gt;&lt;BR /&gt;You closed this thread without evaluatiing or commenting on much of the information you were provided:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://forums11.itrc.hp.com/service/forums/questionanswer.do?threadId=1355210" target="_blank"&gt;http://forums11.itrc.hp.com/service/forums/questionanswer.do?threadId=1355210&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Perl's 'find2perl' is designed to be a helper agent to translate shell 'find()' syntax into Perl.&lt;BR /&gt;&lt;BR /&gt;That said, you could do this in the shell as:&lt;BR /&gt;&lt;BR /&gt;# find /path -xdev -type f -nouser&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;BR /&gt;&lt;BR /&gt;</description>
    <pubDate>Tue, 14 Jul 2009 15:14:44 GMT</pubDate>
    <dc:creator>James R. Ferguson</dc:creator>
    <dc:date>2009-07-14T15:14:44Z</dc:date>
    <item>
      <title>Perl and find command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/perl-and-find-command/m-p/4459532#M679955</link>
      <description>Hello,&lt;BR /&gt;I am using find2perl for finding files with no UIDs.&lt;BR /&gt;&lt;BR /&gt;#! /usr/opt/perl5/bin/perl -w&lt;BR /&gt;    eval 'exec /usr/opt/perl5/bin/perl -S $0 ${1+"$@"}'&lt;BR /&gt;        if 0; #$running_under_some_shell&lt;BR /&gt; &lt;BR /&gt;use strict;&lt;BR /&gt;use File::Find ();&lt;BR /&gt; &lt;BR /&gt;# Set the variable $File::Find::dont_use_nlink if you're using AFS,&lt;BR /&gt;# since AFS cheats.&lt;BR /&gt; &lt;BR /&gt;# for the convenience of &amp;amp;wanted calls, including -eval statements:&lt;BR /&gt;use vars qw/*name *dir *prune/;&lt;BR /&gt;*name   = *File::Find::name;&lt;BR /&gt;*dir    = *File::Find::dir;&lt;BR /&gt;*prune  = *File::Find::prune;&lt;BR /&gt; &lt;BR /&gt;sub wanted;&lt;BR /&gt; &lt;BR /&gt; &lt;BR /&gt;my (%uid, %user);&lt;BR /&gt;while (my ($name, $pw, $uid) = getpwent) {&lt;BR /&gt;    $uid{$name} = $uid{$uid} = $uid;&lt;BR /&gt;}&lt;BR /&gt; &lt;BR /&gt; &lt;BR /&gt;# Traverse desired filesystems&lt;BR /&gt;File::Find::find({wanted =&amp;gt; \&amp;amp;wanted}, '/');&lt;BR /&gt;exit;&lt;BR /&gt; &lt;BR /&gt; &lt;BR /&gt;sub wanted {&lt;BR /&gt;    my ($dev,$ino,$mode,$nlink,$uid,$gid);&lt;BR /&gt; &lt;BR /&gt;    (&lt;BR /&gt;        (($dev,$ino,$mode,$nlink,$uid,$gid) = lstat($_)) &amp;amp;&amp;amp;&lt;BR /&gt;        ($dev &amp;gt;= 0)&lt;BR /&gt;        ||&lt;BR /&gt;        ($dev &amp;gt;= 0)&lt;BR /&gt;    ) &amp;amp;&amp;amp;&lt;BR /&gt;    !exists $uid{$uid} &amp;amp;&amp;amp;&lt;BR /&gt;    print("$name\n");&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;Can someone help in fixing the following errors.&lt;BR /&gt;Use of uninitialized value in numeric ge (&amp;gt;=) at ./find_owner_script.pl line 35.&lt;BR /&gt;Use of uninitialized value in exists at ./find_owner_script.pl line 35.&lt;BR /&gt;&lt;BR /&gt;Also I would like to exclude proc from the search.&lt;BR /&gt;&lt;BR /&gt;Thanks.</description>
      <pubDate>Tue, 14 Jul 2009 14:58:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/perl-and-find-command/m-p/4459532#M679955</guid>
      <dc:creator>Robert Legatie</dc:creator>
      <dc:date>2009-07-14T14:58:00Z</dc:date>
    </item>
    <item>
      <title>Re: Perl and find command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/perl-and-find-command/m-p/4459533#M679956</link>
      <description>Hi Robert:&lt;BR /&gt;&lt;BR /&gt;Why are you adding Perl to what you can't do in a shell?&lt;BR /&gt;&lt;BR /&gt;You closed this thread without evaluatiing or commenting on much of the information you were provided:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://forums11.itrc.hp.com/service/forums/questionanswer.do?threadId=1355210" target="_blank"&gt;http://forums11.itrc.hp.com/service/forums/questionanswer.do?threadId=1355210&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Perl's 'find2perl' is designed to be a helper agent to translate shell 'find()' syntax into Perl.&lt;BR /&gt;&lt;BR /&gt;That said, you could do this in the shell as:&lt;BR /&gt;&lt;BR /&gt;# find /path -xdev -type f -nouser&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 14 Jul 2009 15:14:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/perl-and-find-command/m-p/4459533#M679956</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2009-07-14T15:14:44Z</dc:date>
    </item>
    <item>
      <title>Re: Perl and find command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/perl-and-find-command/m-p/4459534#M679957</link>
      <description>I am using perl to expedite the find command. I know it can be done using shell and I am trying to use perl to compare each of them.&lt;BR /&gt;&lt;BR /&gt;Thanks.</description>
      <pubDate>Tue, 14 Jul 2009 16:22:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/perl-and-find-command/m-p/4459534#M679957</guid>
      <dc:creator>Robert Legatie</dc:creator>
      <dc:date>2009-07-14T16:22:01Z</dc:date>
    </item>
    <item>
      <title>Re: Perl and find command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/perl-and-find-command/m-p/4459535#M679958</link>
      <description>&lt;!--!*#--&gt;Hi (again) Robert:&lt;BR /&gt;&lt;BR /&gt;&amp;gt; I am using perl to expedite the find command.  I know it can be done using shell and I am trying to use perl to compare each of them.&lt;BR /&gt;&lt;BR /&gt;OK, then here's a cleaned up variation of what you posted:&lt;BR /&gt;&lt;BR /&gt;# cat ./findnousers&lt;BR /&gt;#!/usr/bin/perl&lt;BR /&gt;use strict;&lt;BR /&gt;use warnings;&lt;BR /&gt;use File::Find ();&lt;BR /&gt;&lt;BR /&gt;my @path = @ARGV ? @ARGV : ('.');&lt;BR /&gt;my ( %uid, $name, $pw, $uid );&lt;BR /&gt;&lt;BR /&gt;sub wanted {&lt;BR /&gt;    my ( $dev, $ino, $mode, $nlink, $uid, $gid );&lt;BR /&gt;    ( ( $dev, $ino, $mode, $nlink, $uid, $gid ) = lstat($_) )&lt;BR /&gt;        &amp;amp;&amp;amp; !exists $uid{$uid}&lt;BR /&gt;        and print "$File::Find::name\n";&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;while ( ( $name, $pw, $uid ) = getpwent ) {&lt;BR /&gt;    $uid{$uid}++;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;File::Find::find( { wanted =&amp;gt; \&amp;amp;wanted }, @path );&lt;BR /&gt;exit;&lt;BR /&gt;&lt;BR /&gt;...&lt;BR /&gt;&lt;BR /&gt;You can run passing zero or more path arguments.  If no arguments are given then the current working directory is assumed.&lt;BR /&gt;&lt;BR /&gt;# ./findnousers /home&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Tue, 14 Jul 2009 17:32:52 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/perl-and-find-command/m-p/4459535#M679958</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2009-07-14T17:32:52Z</dc:date>
    </item>
  </channel>
</rss>

