<?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 list file mode in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/list-file-mode/m-p/3716826#M791407</link>
    <description>Hi all,&lt;BR /&gt;&lt;BR /&gt;Run ls -l&lt;BR /&gt;-rwxr-x--- 1 owner group size date filename&lt;BR /&gt;&lt;BR /&gt;How to get filename in mode 750 instead of &lt;BR /&gt;-rwxr-x---&lt;BR /&gt;&lt;BR /&gt;Thanks ?&lt;BR /&gt;</description>
    <pubDate>Tue, 24 Jan 2006 23:20:11 GMT</pubDate>
    <dc:creator>ikbea</dc:creator>
    <dc:date>2006-01-24T23:20:11Z</dc:date>
    <item>
      <title>list file mode</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/list-file-mode/m-p/3716826#M791407</link>
      <description>Hi all,&lt;BR /&gt;&lt;BR /&gt;Run ls -l&lt;BR /&gt;-rwxr-x--- 1 owner group size date filename&lt;BR /&gt;&lt;BR /&gt;How to get filename in mode 750 instead of &lt;BR /&gt;-rwxr-x---&lt;BR /&gt;&lt;BR /&gt;Thanks ?&lt;BR /&gt;</description>
      <pubDate>Tue, 24 Jan 2006 23:20:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/list-file-mode/m-p/3716826#M791407</guid>
      <dc:creator>ikbea</dc:creator>
      <dc:date>2006-01-24T23:20:11Z</dc:date>
    </item>
    <item>
      <title>Re: list file mode</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/list-file-mode/m-p/3716827#M791408</link>
      <description>Uh...-rwxr-x--- is 750 - you mean you want it to display as 750?&lt;BR /&gt;&lt;BR /&gt;Rgds...Geoff</description>
      <pubDate>Tue, 24 Jan 2006 23:23:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/list-file-mode/m-p/3716827#M791408</guid>
      <dc:creator>Geoff Wild</dc:creator>
      <dc:date>2006-01-24T23:23:51Z</dc:date>
    </item>
    <item>
      <title>Re: list file mode</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/list-file-mode/m-p/3716828#M791409</link>
      <description>I prepared a script for get mode of filename. For some reason, I want to get 750 (number) instead of -rwxr-x---.</description>
      <pubDate>Wed, 25 Jan 2006 01:34:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/list-file-mode/m-p/3716828#M791409</guid>
      <dc:creator>ikbea</dc:creator>
      <dc:date>2006-01-25T01:34:41Z</dc:date>
    </item>
    <item>
      <title>Re: list file mode</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/list-file-mode/m-p/3716829#M791410</link>
      <description>You could create a script and use the cut command and case  to convert the permissions, something like this logic:&lt;BR /&gt;&lt;BR /&gt;result = cut from 2-4&lt;BR /&gt;case result = rwx then mode 700&lt;BR /&gt;case result = rw- then mode 600&lt;BR /&gt;case result = r-- then mode 400&lt;BR /&gt;and so on&lt;BR /&gt;&lt;BR /&gt;result = cut from 5-7&lt;BR /&gt;case = rwx then mode 700+70&lt;BR /&gt;and so on&lt;BR /&gt;&lt;BR /&gt;Probably some good c programmer on this forum could do this easily.</description>
      <pubDate>Wed, 25 Jan 2006 01:45:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/list-file-mode/m-p/3716829#M791410</guid>
      <dc:creator>Ivan Ferreira</dc:creator>
      <dc:date>2006-01-25T01:45:30Z</dc:date>
    </item>
    <item>
      <title>Re: list file mode</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/list-file-mode/m-p/3716830#M791411</link>
      <description>Use this:&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/perl&lt;BR /&gt;&lt;BR /&gt;# Input is like permission only = -rwxrw-rw-&lt;BR /&gt;&lt;BR /&gt;while (&amp;lt;&amp;gt;)&lt;BR /&gt;{&lt;BR /&gt;  @arr=split //;&lt;BR /&gt;  for ($i=1;$i&amp;lt;=3;$i++) {&lt;BR /&gt;    if ( $arr[$i] =~ /r/ ) {&lt;BR /&gt;      $own+=4;&lt;BR /&gt;    }&lt;BR /&gt;    if ( $arr[$i] =~ /w/ ) {&lt;BR /&gt;      $own+=2;&lt;BR /&gt;    }&lt;BR /&gt;    if ( $arr[$i] =~ /x/ ) {&lt;BR /&gt;      $own+=1;&lt;BR /&gt;    }&lt;BR /&gt;    if ( $arr[$i] =~ /s/ ) {&lt;BR /&gt;      $own+=1;&lt;BR /&gt;      $SID+=4;&lt;BR /&gt;    }&lt;BR /&gt;    if ( $arr[$i] =~ /S/ ) {&lt;BR /&gt;      $SID+=4;&lt;BR /&gt;    }&lt;BR /&gt;  }&lt;BR /&gt;  for ($i=4;$i&amp;lt;=6;$i++) {&lt;BR /&gt;    if ( $arr[$i] =~ /r/ ) {&lt;BR /&gt;      $group+=4;&lt;BR /&gt;    }&lt;BR /&gt;    if ( $arr[$i] =~ /w/ ) {&lt;BR /&gt;      $group+=2;&lt;BR /&gt;    }&lt;BR /&gt;    if ( $arr[$i] =~ /x/ ) {&lt;BR /&gt;      $group+=1;&lt;BR /&gt;    }&lt;BR /&gt;    if ( $arr[$i] =~ /s/ ) {&lt;BR /&gt;      $group+=1;&lt;BR /&gt;      $SID+=2;&lt;BR /&gt;    }&lt;BR /&gt;    if ( $arr[$i] =~ /S/ ) {&lt;BR /&gt;      $SID+=2;&lt;BR /&gt;    }&lt;BR /&gt;  }&lt;BR /&gt;  for ($i=7;$i&amp;lt;=9;$i++) {&lt;BR /&gt;    if ( $arr[$i] =~ /r/ ) {&lt;BR /&gt;      $other+=4;&lt;BR /&gt;    }&lt;BR /&gt;    if ( $arr[$i] =~ /w/ ) {&lt;BR /&gt;      $other+=2;&lt;BR /&gt;    }&lt;BR /&gt;    if ( $arr[$i] =~ /x/ ) {&lt;BR /&gt;      $other+=1;&lt;BR /&gt;    }&lt;BR /&gt;    if ( $arr[$i] =~ /t/ ) {&lt;BR /&gt;      $other+=1;&lt;BR /&gt;      $SID+=1;&lt;BR /&gt;    }&lt;BR /&gt;    if ( $arr[$i] =~ /T/ ) {&lt;BR /&gt;      $SID+=1;&lt;BR /&gt;    }&lt;BR /&gt;  }&lt;BR /&gt;  print $SID . $own . $group . $other . "\n";&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;save it as mode.pl&lt;BR /&gt;&lt;BR /&gt;Execution:&lt;BR /&gt;&lt;BR /&gt;# echo "-rwsrwsrw-" | perl mode.pl&lt;BR /&gt;6776&lt;BR /&gt;# echo "-rwsrwsrwT" | perl mode.pl&lt;BR /&gt;7776&lt;BR /&gt;&lt;BR /&gt;Or simply as,&lt;BR /&gt;&lt;BR /&gt;# ls -l &lt;FILENAME&gt; | awk '{ print $1; }' | perl mode.pl&lt;BR /&gt;&lt;BR /&gt;--&lt;BR /&gt;Muthu&lt;BR /&gt;&lt;/FILENAME&gt;</description>
      <pubDate>Wed, 25 Jan 2006 01:56:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/list-file-mode/m-p/3716830#M791411</guid>
      <dc:creator>Muthukumar_5</dc:creator>
      <dc:date>2006-01-25T01:56:12Z</dc:date>
    </item>
    <item>
      <title>Re: list file mode</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/list-file-mode/m-p/3716831#M791412</link>
      <description>Hi,&lt;BR /&gt;can I suggest you have a look at:&lt;BR /&gt;&lt;A href="http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=60179" target="_blank"&gt;http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=60179&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Previously asked question</description>
      <pubDate>Wed, 25 Jan 2006 02:46:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/list-file-mode/m-p/3716831#M791412</guid>
      <dc:creator>Peter Godron</dc:creator>
      <dc:date>2006-01-25T02:46:07Z</dc:date>
    </item>
    <item>
      <title>Re: list file mode</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/list-file-mode/m-p/3716832#M791413</link>
      <description>Hi,&lt;BR /&gt; &lt;BR /&gt;if you already use Perl for the task,&lt;BR /&gt;why not use Perl's built ins (viz. stat())?&lt;BR /&gt; &lt;BR /&gt;e.g.&lt;BR /&gt;you could collect mode bits in a file to mode hash like this&lt;BR /&gt; &lt;BR /&gt;my $dir2stat = '/etc';&lt;BR /&gt;my $dh = do { local *DH };&lt;BR /&gt;opendir $dh, $dir2stat or die "Cannot opendir(): $!\n";&lt;BR /&gt;my %mbits;&lt;BR /&gt;map { $mbits{$_} = sprintf '%04o', (stat)[2] &amp;amp; 07777 }&lt;BR /&gt;            map "$dir2stat/$_",&lt;BR /&gt;            grep(!/^\.{1,2}/, readdir $dh);&lt;BR /&gt;closedir $dh;&lt;BR /&gt; &lt;BR /&gt; &lt;BR /&gt;For details please refer to "perldoc -f stat".&lt;BR /&gt; &lt;BR /&gt;HTH&lt;BR /&gt;Ralph&lt;BR /&gt;</description>
      <pubDate>Wed, 25 Jan 2006 03:25:06 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/list-file-mode/m-p/3716832#M791413</guid>
      <dc:creator>Ralph Grothe</dc:creator>
      <dc:date>2006-01-25T03:25:06Z</dc:date>
    </item>
  </channel>
</rss>

