<?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: if statement for file size in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/if-statement-for-file-size/m-p/3191950#M164967</link>
    <description>You got spelling problem.  Should have read:&lt;BR /&gt;&lt;BR /&gt;if [ file size -gt 60 ]&lt;BR /&gt;then &lt;BR /&gt;blah&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;Hai&lt;BR /&gt;&lt;BR /&gt;</description>
    <pubDate>Fri, 13 Feb 2004 13:31:40 GMT</pubDate>
    <dc:creator>Hai Nguyen_1</dc:creator>
    <dc:date>2004-02-13T13:31:40Z</dc:date>
    <item>
      <title>if statement for file size</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/if-statement-for-file-size/m-p/3191948#M164965</link>
      <description>is there a simple if statement for a file size?&lt;BR /&gt;&lt;BR /&gt;if [ file size -gt 60 ]&lt;BR /&gt;than &lt;BR /&gt;blah&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;Doesnot work.</description>
      <pubDate>Fri, 13 Feb 2004 13:24:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/if-statement-for-file-size/m-p/3191948#M164965</guid>
      <dc:creator>Ratzie</dc:creator>
      <dc:date>2004-02-13T13:24:36Z</dc:date>
    </item>
    <item>
      <title>Re: if statement for file size</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/if-statement-for-file-size/m-p/3191949#M164966</link>
      <description>No directly: You need to leverage ls -l and awk (as but one method):&lt;BR /&gt;&lt;BR /&gt;FNAME=myfile&lt;BR /&gt;typeset -i10 SZ=$(ls -l ${FNAME} | awk '{print $5}')&lt;BR /&gt;if [[ ${SZ} -gt 60 ]]&lt;BR /&gt;  then&lt;BR /&gt;    blah&lt;BR /&gt;    blah&lt;BR /&gt;  fi&lt;BR /&gt;&lt;BR /&gt;The only built-in test is &lt;BR /&gt;if [[ -s ${FNAME} ]]&lt;BR /&gt;which tests id ${FNAME exists and has a size &amp;gt; 0.&lt;BR /&gt;</description>
      <pubDate>Fri, 13 Feb 2004 13:30:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/if-statement-for-file-size/m-p/3191949#M164966</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2004-02-13T13:30:25Z</dc:date>
    </item>
    <item>
      <title>Re: if statement for file size</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/if-statement-for-file-size/m-p/3191950#M164967</link>
      <description>You got spelling problem.  Should have read:&lt;BR /&gt;&lt;BR /&gt;if [ file size -gt 60 ]&lt;BR /&gt;then &lt;BR /&gt;blah&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;Hai&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 13 Feb 2004 13:31:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/if-statement-for-file-size/m-p/3191950#M164967</guid>
      <dc:creator>Hai Nguyen_1</dc:creator>
      <dc:date>2004-02-13T13:31:40Z</dc:date>
    </item>
    <item>
      <title>Re: if statement for file size</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/if-statement-for-file-size/m-p/3191951#M164968</link>
      <description>ll | awk '{$5&amp;gt;60)'&lt;BR /&gt;&lt;BR /&gt;Would get you all the files &amp;gt; then 60 bytes.&lt;BR /&gt;&lt;BR /&gt;Best regards,&lt;BR /&gt;&lt;BR /&gt;Kent Ostby&lt;BR /&gt;</description>
      <pubDate>Fri, 13 Feb 2004 13:38:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/if-statement-for-file-size/m-p/3191951#M164968</guid>
      <dc:creator>Kent Ostby</dc:creator>
      <dc:date>2004-02-13T13:38:49Z</dc:date>
    </item>
    <item>
      <title>Re: if statement for file size</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/if-statement-for-file-size/m-p/3191952#M164969</link>
      <description>find file -size +61c &amp;gt;/dev/null&lt;BR /&gt;if [ $? -lt 1 ]&lt;BR /&gt;then&lt;BR /&gt;    blah&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;Best regards,&lt;BR /&gt;&lt;BR /&gt;dl</description>
      <pubDate>Fri, 13 Feb 2004 14:00:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/if-statement-for-file-size/m-p/3191952#M164969</guid>
      <dc:creator>Dave La Mar</dc:creator>
      <dc:date>2004-02-13T14:00:32Z</dc:date>
    </item>
    <item>
      <title>Re: if statement for file size</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/if-statement-for-file-size/m-p/3191953#M164970</link>
      <description>ll|awk '{if($5&amp;gt;=60) print}'&lt;BR /&gt;&lt;BR /&gt;Will print files of 60 bytes and more.</description>
      <pubDate>Fri, 13 Feb 2004 14:09:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/if-statement-for-file-size/m-p/3191953#M164970</guid>
      <dc:creator>RAC_1</dc:creator>
      <dc:date>2004-02-13T14:09:20Z</dc:date>
    </item>
    <item>
      <title>Re: if statement for file size</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/if-statement-for-file-size/m-p/3191954#M164971</link>
      <description>Try this&lt;BR /&gt;&lt;BR /&gt;LOGSIZE=$((`du -k $LOG | awk '{print $1}'`))&lt;BR /&gt;&lt;BR /&gt;Assuming $LOG is the name of the file.&lt;BR /&gt;&lt;BR /&gt;Hope it helps.&lt;BR /&gt;</description>
      <pubDate>Fri, 13 Feb 2004 14:14:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/if-statement-for-file-size/m-p/3191954#M164971</guid>
      <dc:creator>Tom Smith_9</dc:creator>
      <dc:date>2004-02-13T14:14:23Z</dc:date>
    </item>
    <item>
      <title>Re: if statement for file size</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/if-statement-for-file-size/m-p/3191955#M164972</link>
      <description>Sorry my last post was missing this,&lt;BR /&gt;&lt;BR /&gt;if [ $(( $LOGSIZE &amp;gt; $LOGSIZELIMIT )) != 0 ] ; then</description>
      <pubDate>Fri, 13 Feb 2004 14:28:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/if-statement-for-file-size/m-p/3191955#M164972</guid>
      <dc:creator>Tom Smith_9</dc:creator>
      <dc:date>2004-02-13T14:28:49Z</dc:date>
    </item>
    <item>
      <title>Re: if statement for file size</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/if-statement-for-file-size/m-p/3191956#M164973</link>
      <description>&lt;BR /&gt;In perl there is:  -s  &lt;BR /&gt;&lt;BR /&gt;Usage example:&lt;BR /&gt;&lt;BR /&gt;perl -e 'while (&amp;lt;*&amp;gt;) { print -s," $_\n" if (-s &amp;gt; 6000)}'&lt;BR /&gt;&lt;BR /&gt;Hein.</description>
      <pubDate>Fri, 13 Feb 2004 14:36:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/if-statement-for-file-size/m-p/3191956#M164973</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2004-02-13T14:36:19Z</dc:date>
    </item>
    <item>
      <title>Re: if statement for file size</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/if-statement-for-file-size/m-p/3191957#M164974</link>
      <description>One thing to bear in mind: most shell commands have problems calculating and perhaps comparing with values larger the 2G.&lt;BR /&gt;If your file might be in that range, you can alter Clay's shell solution to divide the size by 1024, for instance, to get the size in kb in your awk part (awk '/file$/{printf "%d\n",$5/1024}).&lt;BR /&gt;&lt;BR /&gt;You could also use things like 'wc -b &lt;FILE&gt;', though I wouldn't recommend this for large files (it will literally count bytes in the file!) or 'du -k &lt;FILE&gt; | cut -f1' to get the size in kb.&lt;BR /&gt;ls -s is also a solution, but will get you the size of the file in filesystemblocksize, which might not be what you want.&lt;BR /&gt;&lt;BR /&gt;&lt;/FILE&gt;&lt;/FILE&gt;</description>
      <pubDate>Fri, 13 Feb 2004 14:49:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/if-statement-for-file-size/m-p/3191957#M164974</guid>
      <dc:creator>Elmar P. Kolkman</dc:creator>
      <dc:date>2004-02-13T14:49:48Z</dc:date>
    </item>
  </channel>
</rss>

