<?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: AWK number range in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-number-range/m-p/4762411#M657243</link>
    <description>0=7 should read as 0-7 in my first post.&lt;BR /&gt;</description>
    <pubDate>Mon, 07 Mar 2011 22:42:45 GMT</pubDate>
    <dc:creator>Patrick Ware_1</dc:creator>
    <dc:date>2011-03-07T22:42:45Z</dc:date>
    <item>
      <title>AWK number range</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-number-range/m-p/4762409#M657241</link>
      <description>&lt;!--!*#--&gt;Hello all.  I am in the process of doing mass edits on a file that deals with security defaults.  I am using an awk line to check for PASSLENGTH being 8 or more in the file.  If it is less than 8, I want to replace the line with:&lt;BR /&gt;&lt;BR /&gt;PASSLENGTH=8&lt;BR /&gt;&lt;BR /&gt;Currently I am accomplishing this with the following below:&lt;BR /&gt;&lt;BR /&gt;awk '{sub(/PASSLENGTH=6|PASSLENGTH=5|PASSLENGTH=4/,"PASSLENGTH=8")};{print}' ${CHG_FILE} &amp;gt; ${CHG_FILE}.tmp&lt;BR /&gt;mv ${CHG_FILE}.tmp ${CHG_FILE}&lt;BR /&gt;&lt;BR /&gt;What I need to know is if there is a way to specify a range, or tell it instead that if the value for PASSLENGTH is 0=7, then take action?&lt;BR /&gt;&lt;BR /&gt;Don't worry, when I pick up the kids today, I will be at the book store getting an awk reference book.</description>
      <pubDate>Mon, 07 Mar 2011 20:11:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-number-range/m-p/4762409#M657241</guid>
      <dc:creator>Patrick Ware_1</dc:creator>
      <dc:date>2011-03-07T20:11:07Z</dc:date>
    </item>
    <item>
      <title>Re: AWK number range</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-number-range/m-p/4762410#M657242</link>
      <description>Something like:&lt;BR /&gt;awk '&lt;BR /&gt;{&lt;BR /&gt;sub(/PASSLENGTH=[0-7][^0-9]/,"PASSLENGTH=8")&lt;BR /&gt;print}'&lt;BR /&gt;&lt;BR /&gt;If it is a two digit number, it will fail if you have 07.</description>
      <pubDate>Mon, 07 Mar 2011 20:26:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-number-range/m-p/4762410#M657242</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2011-03-07T20:26:14Z</dc:date>
    </item>
    <item>
      <title>Re: AWK number range</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-number-range/m-p/4762411#M657243</link>
      <description>0=7 should read as 0-7 in my first post.&lt;BR /&gt;</description>
      <pubDate>Mon, 07 Mar 2011 22:42:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-number-range/m-p/4762411#M657243</guid>
      <dc:creator>Patrick Ware_1</dc:creator>
      <dc:date>2011-03-07T22:42:45Z</dc:date>
    </item>
    <item>
      <title>Re: AWK number range</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-number-range/m-p/4762412#M657244</link>
      <description>How firm/predictable is the input ?&lt;BR /&gt;&lt;BR /&gt;Any optional spaces or line comments to deal with?&lt;BR /&gt;&lt;BR /&gt;You could tell awk to &lt;BR /&gt;- first look for lines starting with PASSLENGTH&lt;BR /&gt;- split into an array of words around =&lt;BR /&gt;- compare the second word with 8&lt;BR /&gt;- force fresh $0 line if less than 8&lt;BR /&gt;- print $0&lt;BR /&gt;&lt;BR /&gt;$ awk '/^PASSLENGTH=/{ split ($0,a,/=/); if (a[2] &amp;lt; 8) $0 = a[1] "=8"} {print}' tmp.txt&lt;BR /&gt;&lt;BR /&gt;example input/output below.&lt;BR /&gt;&lt;BR /&gt;Hein&lt;BR /&gt;&lt;BR /&gt;$ cat tmp.txt&lt;BR /&gt;PASSLENGTH=12&lt;BR /&gt;PASSLENGTH=18&lt;BR /&gt;PASSLENGTH=06&lt;BR /&gt;PASSLENGTH=6&lt;BR /&gt;xxxxxENGTH=6&lt;BR /&gt;PASSLENGTH=08&lt;BR /&gt;PASSLENGTH=0&lt;BR /&gt;PASSLENGTH=2&lt;BR /&gt;PASSLENGTH=10&lt;BR /&gt;&lt;BR /&gt;---- output ----&lt;BR /&gt;&lt;BR /&gt;PASSLENGTH=12&lt;BR /&gt;PASSLENGTH=18&lt;BR /&gt;PASSLENGTH=8&lt;BR /&gt;PASSLENGTH=8&lt;BR /&gt;xxxxxENGTH=6&lt;BR /&gt;PASSLENGTH=08&lt;BR /&gt;PASSLENGTH=8&lt;BR /&gt;PASSLENGTH=8&lt;BR /&gt;PASSLENGTH=10&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 07 Mar 2011 22:46:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-number-range/m-p/4762412#M657244</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2011-03-07T22:46:11Z</dc:date>
    </item>
    <item>
      <title>Re: AWK number range</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-number-range/m-p/4762413#M657245</link>
      <description>Dennis, for some reason the help you gave me didn't seem to work out for me.</description>
      <pubDate>Mon, 07 Mar 2011 23:13:37 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-number-range/m-p/4762413#M657245</guid>
      <dc:creator>Patrick Ware_1</dc:creator>
      <dc:date>2011-03-07T23:13:37Z</dc:date>
    </item>
    <item>
      <title>Re: AWK number range</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-number-range/m-p/4762414#M657246</link>
      <description>&amp;gt;for some reason the help you gave me didn't seem to work out for me.&lt;BR /&gt;&lt;BR /&gt;Possibly you only had one digit, this works a little better:&lt;BR /&gt;sub(/PASSLENGTH=[0-7]$/,"PASSLENGTH=8")&lt;BR /&gt;&lt;BR /&gt;But as with Hein's example, it is better to get that number than try to pattern match the possibly two digits.</description>
      <pubDate>Tue, 08 Mar 2011 06:04:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-number-range/m-p/4762414#M657246</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2011-03-08T06:04:00Z</dc:date>
    </item>
    <item>
      <title>Re: AWK number range</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-number-range/m-p/4762415#M657247</link>
      <description>Yes, it was only single digit numbers.</description>
      <pubDate>Tue, 08 Mar 2011 13:40:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-number-range/m-p/4762415#M657247</guid>
      <dc:creator>Patrick Ware_1</dc:creator>
      <dc:date>2011-03-08T13:40:30Z</dc:date>
    </item>
  </channel>
</rss>

