<?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: How to get info on file attributes ? Like lenght of file in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-get-info-on-file-attributes-like-lenght-of-file/m-p/3857915#M276145</link>
    <description>Hi (again):&lt;BR /&gt;&lt;BR /&gt;...and in keeping with our running dialog, I should add this alternative:&lt;BR /&gt;&lt;BR /&gt;# perl -le '$t=-M $ARGV[0];print $ARGV[0], " is ", $t*86400, " seconds old"' file&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
    <pubDate>Wed, 06 Sep 2006 17:47:45 GMT</pubDate>
    <dc:creator>James R. Ferguson</dc:creator>
    <dc:date>2006-09-06T17:47:45Z</dc:date>
    <item>
      <title>How to get info on file attributes ? Like lenght of file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-get-info-on-file-attributes-like-lenght-of-file/m-p/3857906#M276136</link>
      <description>HP-UX B.11.11 U 9000/800/rp3410&lt;BR /&gt;#########################################&lt;BR /&gt;&lt;BR /&gt;Hello All,&lt;BR /&gt;&lt;BR /&gt; Is there a way to determine the lenght of a file? or to get the attributes of a file ?</description>
      <pubDate>Wed, 06 Sep 2006 14:45:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-get-info-on-file-attributes-like-lenght-of-file/m-p/3857906#M276136</guid>
      <dc:creator>Jerry_109</dc:creator>
      <dc:date>2006-09-06T14:45:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to get info on file attributes ? Like lenght of file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-get-info-on-file-attributes-like-lenght-of-file/m-p/3857907#M276137</link>
      <description>if you know the path for the file then do ll&lt;BR /&gt;&lt;BR /&gt;ll /home/file1&lt;BR /&gt;&lt;BR /&gt;which will show you modification date and time, size of the file and ownership etc..</description>
      <pubDate>Wed, 06 Sep 2006 14:49:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-get-info-on-file-attributes-like-lenght-of-file/m-p/3857907#M276137</guid>
      <dc:creator>IT_2007</dc:creator>
      <dc:date>2006-09-06T14:49:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to get info on file attributes ? Like lenght of file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-get-info-on-file-attributes-like-lenght-of-file/m-p/3857908#M276138</link>
      <description>you mean the permissions?&lt;BR /&gt;&lt;BR /&gt;ls -al&lt;BR /&gt;&lt;BR /&gt;when you say length, I am assuming you mean how many lines are in the file:&lt;BR /&gt;&lt;BR /&gt;cat filename | wc -l&lt;BR /&gt;&lt;BR /&gt;I wouldn't use cat on a binary file!&lt;BR /&gt;&lt;BR /&gt;use file filename to determine filetype first</description>
      <pubDate>Wed, 06 Sep 2006 14:50:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-get-info-on-file-attributes-like-lenght-of-file/m-p/3857908#M276138</guid>
      <dc:creator>Sean Dale</dc:creator>
      <dc:date>2006-09-06T14:50:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to get info on file attributes ? Like lenght of file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-get-info-on-file-attributes-like-lenght-of-file/m-p/3857909#M276139</link>
      <description>Hi Jerry:&lt;BR /&gt;&lt;BR /&gt;By file attributes, I presume that you mean things like the modification timestamp, the lastaccess timestamp, the last inode change timestamp, the size of the file in characters, for instance.&lt;BR /&gt;&lt;BR /&gt;The 'ls' command offers the above information.  Look at the manpages for 'ls' along with the manpages for 'stat(2)'.  It's the 'stat' structure that holds these attributes.&lt;BR /&gt;&lt;BR /&gt;If you mean the "type" or "kind" of file, use the 'file' command.  The manpages for 'file' will enlighten you on how the "magic" [pun intended!] is performed to deduce whether a file is a "text" or a "binary" file for instance.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 06 Sep 2006 14:53:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-get-info-on-file-attributes-like-lenght-of-file/m-p/3857909#M276139</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2006-09-06T14:53:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to get info on file attributes ? Like lenght of file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-get-info-on-file-attributes-like-lenght-of-file/m-p/3857910#M276140</link>
      <description>One of the best ways is the Perl stat() function. It will load an array with all of the attributes of a file and you can pick and choose the ones you want. You would probably feed the timestamps returned by stat() to localtime() to convert the epoch seconds into a more user-friendly format.</description>
      <pubDate>Wed, 06 Sep 2006 15:04:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-get-info-on-file-attributes-like-lenght-of-file/m-p/3857910#M276140</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2006-09-06T15:04:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to get info on file attributes ? Like lenght of file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-get-info-on-file-attributes-like-lenght-of-file/m-p/3857911#M276141</link>
      <description>Good call, Clay!  I didn't even think of that (and I use Perl for everything)!</description>
      <pubDate>Wed, 06 Sep 2006 15:22:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-get-info-on-file-attributes-like-lenght-of-file/m-p/3857911#M276141</guid>
      <dc:creator>Sean Dale</dc:creator>
      <dc:date>2006-09-06T15:22:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to get info on file attributes ? Like lenght of file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-get-info-on-file-attributes-like-lenght-of-file/m-p/3857912#M276142</link>
      <description>Hi (again):&lt;BR /&gt;&lt;BR /&gt;In addition to using 'stat()' in a Perl script, Perl offers a plethora of file test operators to make life easy, too.  These can make "asking" questions of the stat() information easy.  For instance, instead of dissecting the octal mode from 'stat()' use Perl's "-u" with the file to test if the 'setuid' bit is set.&lt;BR /&gt;&lt;BR /&gt;In reality, the shell 'test' operator has the same ability to determine if a file is readable, or has a size other than zero, or has the setuid bit set.  See the 'test(1)' manpages.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Wed, 06 Sep 2006 15:37:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-get-info-on-file-attributes-like-lenght-of-file/m-p/3857912#M276142</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2006-09-06T15:37:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to get info on file attributes ? Like lenght of file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-get-info-on-file-attributes-like-lenght-of-file/m-p/3857913#M276143</link>
      <description>Can someone give me an example of how to use the "stat" command ?</description>
      <pubDate>Wed, 06 Sep 2006 17:33:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-get-info-on-file-attributes-like-lenght-of-file/m-p/3857913#M276143</guid>
      <dc:creator>Jerry_109</dc:creator>
      <dc:date>2006-09-06T17:33:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to get info on file attributes ? Like lenght of file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-get-info-on-file-attributes-like-lenght-of-file/m-p/3857914#M276144</link>
      <description>Hi Jerry:&lt;BR /&gt;&lt;BR /&gt;An example, using Perl, to report the 'mtime' (modification timestamp) of a file would be:&lt;BR /&gt;&lt;BR /&gt;# perl -le 'print scalar localtime ((stat($ARGV[0]))[8])' file&lt;BR /&gt;&lt;BR /&gt;...which might look like:&lt;BR /&gt;&lt;BR /&gt;# touch /tmp/me&lt;BR /&gt;# perl -le 'print scalar localtime ((stat($ARGV[0]))[8])' /tmp/me&lt;BR /&gt;Wed Sep  6 18:39:51 2006&lt;BR /&gt;&lt;BR /&gt;...where my TZ=EST5EDT&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Wed, 06 Sep 2006 17:40:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-get-info-on-file-attributes-like-lenght-of-file/m-p/3857914#M276144</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2006-09-06T17:40:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to get info on file attributes ? Like lenght of file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-get-info-on-file-attributes-like-lenght-of-file/m-p/3857915#M276145</link>
      <description>Hi (again):&lt;BR /&gt;&lt;BR /&gt;...and in keeping with our running dialog, I should add this alternative:&lt;BR /&gt;&lt;BR /&gt;# perl -le '$t=-M $ARGV[0];print $ARGV[0], " is ", $t*86400, " seconds old"' file&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Wed, 06 Sep 2006 17:47:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-get-info-on-file-attributes-like-lenght-of-file/m-p/3857915#M276145</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2006-09-06T17:47:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to get info on file attributes ? Like lenght of file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-get-info-on-file-attributes-like-lenght-of-file/m-p/3857916#M276146</link>
      <description>Very cool. Thanks. Now what's the command that delivers all the info on a file?&lt;BR /&gt;&lt;BR /&gt;Yes, I know I need to read a perl book, but I'm in a rush. Thanks........... :)&lt;BR /&gt;</description>
      <pubDate>Wed, 06 Sep 2006 17:50:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-get-info-on-file-attributes-like-lenght-of-file/m-p/3857916#M276146</guid>
      <dc:creator>Jerry_109</dc:creator>
      <dc:date>2006-09-06T17:50:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to get info on file attributes ? Like lenght of file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-get-info-on-file-attributes-like-lenght-of-file/m-p/3857917#M276147</link>
      <description>Hi Jerry:&lt;BR /&gt;&lt;BR /&gt;Mother Nature abhors rushing.  However, the top of this page (URL) offers you the answer and the documentation of why for 'mtime' I should have chosen the nineth and not the eight element of 'stat()' in my original example, above :-))&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://perldoc.perl.org/functions/stat.html" target="_blank"&gt;http://perldoc.perl.org/functions/stat.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Wed, 06 Sep 2006 18:19:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-get-info-on-file-attributes-like-lenght-of-file/m-p/3857917#M276147</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2006-09-06T18:19:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to get info on file attributes ? Like lenght of file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-get-info-on-file-attributes-like-lenght-of-file/m-p/3857918#M276148</link>
      <description>Thanks for the info. I located the following, whic hlooks like what I needed&lt;BR /&gt;" size of file, in bytes ":&lt;BR /&gt;&lt;BR /&gt;7 size     total size of file, in bytes&lt;BR /&gt;####################################&lt;BR /&gt;&lt;BR /&gt;but when I entered the following :&lt;BR /&gt;&lt;BR /&gt;# perl -le 'print scalar size ((stat($ARGV[0]))[7])' /tmp/foo&lt;BR /&gt;     &lt;BR /&gt;Undefined subroutine &amp;amp;main::size called at -e line 1.&lt;BR /&gt;&lt;BR /&gt;Seems I just do not get it. I'll take some time to review perl. Thanks&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 06 Sep 2006 18:36:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-get-info-on-file-attributes-like-lenght-of-file/m-p/3857918#M276148</guid>
      <dc:creator>Jerry_109</dc:creator>
      <dc:date>2006-09-06T18:36:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to get info on file attributes ? Like lenght of file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-get-info-on-file-attributes-like-lenght-of-file/m-p/3857919#M276149</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;# perl -le 'print ((stat($ARGV[0]))[7])' /tmp/foo&lt;BR /&gt;&lt;BR /&gt;...returns the size in characters.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Wed, 06 Sep 2006 18:47:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-get-info-on-file-attributes-like-lenght-of-file/m-p/3857919#M276149</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2006-09-06T18:47:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to get info on file attributes ? Like lenght of file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-get-info-on-file-attributes-like-lenght-of-file/m-p/3857920#M276150</link>
      <description>Thank you James, you'er fantastic........ :&amp;gt;)</description>
      <pubDate>Wed, 06 Sep 2006 18:49:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-get-info-on-file-attributes-like-lenght-of-file/m-p/3857920#M276150</guid>
      <dc:creator>Jerry_109</dc:creator>
      <dc:date>2006-09-06T18:49:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to get info on file attributes ? Like lenght of file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-get-info-on-file-attributes-like-lenght-of-file/m-p/3857921#M276151</link>
      <description>I got excited too soon. The 694 is the same number I got from ls. Can a file be measured in binary lenght ?</description>
      <pubDate>Wed, 06 Sep 2006 18:54:04 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-get-info-on-file-attributes-like-lenght-of-file/m-p/3857921#M276151</guid>
      <dc:creator>Jerry_109</dc:creator>
      <dc:date>2006-09-06T18:54:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to get info on file attributes ? Like lenght of file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-get-info-on-file-attributes-like-lenght-of-file/m-p/3857922#M276152</link>
      <description>I got excited too soon. The 694 is the same number I got from ls. Can a file be measured in binary lenght ?&lt;BR /&gt;&lt;BR /&gt;I have no idea what this question means. The value representing the length of a file is in bytes and it is stored in the inode in binary format but in any event the value 694 (decimal) can be converted to whatever radix you choose including base 2 and Perl can do this as well. Now it is also possible that this lenfth doesn't mean what you think it means. Consider the case of writing a single byte at offset 0 and then doing an lseek() to offset 999,999 and writing another siggle byte and then closing the file. How big is this file? ls -l (and stat(), either the system call or the Perl function) will tell you it is 1MB but other utilities that look at the filesystem will tell you that this 1MB file is only 2 blocks (typically 1KiB) long --- and both are right --- they are simply measuring different things --- welcome to "sparse" files. When this file is read, the "missing" bytes are silently filled in with NUL's. To make it more confusing, if you copy this file, the copy will not be sparse and the file will truly be 1MB in length.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 06 Sep 2006 21:10:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-get-info-on-file-attributes-like-lenght-of-file/m-p/3857922#M276152</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2006-09-06T21:10:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to get info on file attributes ? Like lenght of file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-get-info-on-file-attributes-like-lenght-of-file/m-p/3857923#M276153</link>
      <description>Hi Jerry,&lt;BR /&gt;ti get info about a file I use this simple ksh script:&lt;BR /&gt;#!/usr/bin/ksh&lt;BR /&gt;typeset tmp=$(head -1 $1)&lt;BR /&gt;typeset wcr=$(wc $1)&lt;BR /&gt;echo "$(basename $1): Reclen=${#tmp}, Lines=$(echo $wcr|awk '{print $1}'), Size=$(echo $wcr|awk '{print $3}'), \&lt;BR /&gt;Type='$(echo $(file $1)|awk -F ": " '{print $2}')'"&lt;BR /&gt;#eof&lt;BR /&gt;&lt;BR /&gt;i.e:&lt;BR /&gt;finfo finfo&lt;BR /&gt;finfo: Reclen=14, Lines=6, Size=232, Type='commands text'&lt;BR /&gt;&lt;BR /&gt;Take care that teh reclen info is valid only if all the record of your file have teh same length.&lt;BR /&gt;&lt;BR /&gt;If you are interested to know info about records length just use:&lt;BR /&gt;awk '{printf "%2d %6i\n", NR,length($0)}' finfo&lt;BR /&gt;&lt;BR /&gt;i.e:&lt;BR /&gt;awk '{printf "%2d %6i\n", NR,length($0)}' finfo&lt;BR /&gt; 1     14&lt;BR /&gt; 2     25&lt;BR /&gt; 3     20&lt;BR /&gt; 4    112&lt;BR /&gt; 5     51&lt;BR /&gt; 6      4&lt;BR /&gt;&lt;BR /&gt;HTH,&lt;BR /&gt;Art</description>
      <pubDate>Thu, 07 Sep 2006 03:16:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-get-info-on-file-attributes-like-lenght-of-file/m-p/3857923#M276153</guid>
      <dc:creator>Arturo Galbiati</dc:creator>
      <dc:date>2006-09-07T03:16:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to get info on file attributes ? Like lenght of file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-get-info-on-file-attributes-like-lenght-of-file/m-p/3857924#M276154</link>
      <description>Thank you all for the ongoing good information. I took some good notes, and learned a lot. I believe I was getting too&lt;BR /&gt;detailed, and it was not really needed. I now see the "ls" cmd delivers all the attributes I needed. I did learn other ways to obtain info needed. Thanks for putting up with me.&lt;BR /&gt;&lt;BR /&gt;Your Friend.&lt;BR /&gt;Jerry Sims</description>
      <pubDate>Thu, 07 Sep 2006 10:47:55 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-get-info-on-file-attributes-like-lenght-of-file/m-p/3857924#M276154</guid>
      <dc:creator>Jerry_109</dc:creator>
      <dc:date>2006-09-07T10:47:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to get info on file attributes ? Like lenght of file</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-get-info-on-file-attributes-like-lenght-of-file/m-p/3857925#M276155</link>
      <description>Hi (again) Jerry:&lt;BR /&gt;&lt;BR /&gt;As I originally noted, one hopes that 'ls' and 'stat()' return the same values!  After all, 'stat()' is what 'ls' uses :-))&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;..JRF...</description>
      <pubDate>Thu, 07 Sep 2006 10:56:33 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-get-info-on-file-attributes-like-lenght-of-file/m-p/3857925#M276155</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2006-09-07T10:56:33Z</dc:date>
    </item>
  </channel>
</rss>

