<?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 in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/awk/m-p/5034946#M95277</link>
    <description>Hi:&lt;BR /&gt;&lt;BR /&gt;Perhaps:&lt;BR /&gt;&lt;BR /&gt;# awk '$1!~/^[0-9]+$/||$2~/^[0-9]+$/{print;exit 1}' tmp.txt&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
    <pubDate>Tue, 20 Mar 2007 06:47:07 GMT</pubDate>
    <dc:creator>James R. Ferguson</dc:creator>
    <dc:date>2007-03-20T06:47:07Z</dc:date>
    <item>
      <title>awk</title>
      <link>https://community.hpe.com/t5/operating-system-linux/awk/m-p/5034944#M95275</link>
      <description>awk '$1!~/^[0-9]+$/&amp;amp;&amp;amp;$2!~/^[a-zA-Z0-9]+$/{print;exit 1}' tmp.txt&lt;BR /&gt;&lt;BR /&gt;I've got this to work good but the problem is that it's not returning 1 if I have only characters in both fields. I need it to return a vaule of 1 when the first two fields are characters and when the first field is characters and the second field is numbers?&lt;BR /&gt;&lt;BR /&gt;example:&lt;BR /&gt;&lt;BR /&gt;myredcar mybluecar&lt;BR /&gt;mycar  192.168.1.10&lt;BR /&gt;&lt;BR /&gt;it's not returning a value of 1 for the first line but it does work for the second line.</description>
      <pubDate>Tue, 20 Mar 2007 06:39:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/awk/m-p/5034944#M95275</guid>
      <dc:creator>maliaka</dc:creator>
      <dc:date>2007-03-20T06:39:23Z</dc:date>
    </item>
    <item>
      <title>Re: awk</title>
      <link>https://community.hpe.com/t5/operating-system-linux/awk/m-p/5034945#M95276</link>
      <description>Hi,&lt;BR /&gt;have you tried the code without the 'exit 1' ?&lt;BR /&gt;Can you please specify the exact requirements.</description>
      <pubDate>Tue, 20 Mar 2007 06:45:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/awk/m-p/5034945#M95276</guid>
      <dc:creator>Peter Godron</dc:creator>
      <dc:date>2007-03-20T06:45:16Z</dc:date>
    </item>
    <item>
      <title>Re: awk</title>
      <link>https://community.hpe.com/t5/operating-system-linux/awk/m-p/5034946#M95277</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;Perhaps:&lt;BR /&gt;&lt;BR /&gt;# awk '$1!~/^[0-9]+$/||$2~/^[0-9]+$/{print;exit 1}' tmp.txt&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Tue, 20 Mar 2007 06:47:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/awk/m-p/5034946#M95277</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2007-03-20T06:47:07Z</dc:date>
    </item>
    <item>
      <title>Re: awk</title>
      <link>https://community.hpe.com/t5/operating-system-linux/awk/m-p/5034947#M95278</link>
      <description>I tried that but it returns 1 with all of the lines.&lt;BR /&gt;&lt;BR /&gt;Here is my requirements:&lt;BR /&gt;&lt;BR /&gt;cat f1.txt&lt;BR /&gt;myredcar mybluecar&lt;BR /&gt;mycar 192.168.1.10&lt;BR /&gt;192.168.1.1 192.168.1.2&lt;BR /&gt;192.168.1.3 &lt;BR /&gt;&lt;BR /&gt;It should return a failure status for all of the above lines and return a successful status for the following line whenever they exist in the file f1.txt&lt;BR /&gt;&lt;BR /&gt;192.168.1.4 host100&lt;BR /&gt;&lt;BR /&gt;The lines however, should not be less than or exceed 2 fields.&lt;BR /&gt;&lt;BR /&gt;awk '{NF ==2}' f1.txt, I would like to add this one to the same awk statement so that I'll have only one line of awk commands.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 21 Mar 2007 07:35:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/awk/m-p/5034947#M95278</guid>
      <dc:creator>maliaka</dc:creator>
      <dc:date>2007-03-21T07:35:20Z</dc:date>
    </item>
    <item>
      <title>Re: awk</title>
      <link>https://community.hpe.com/t5/operating-system-linux/awk/m-p/5034948#M95279</link>
      <description>Hi (again):&lt;BR /&gt;&lt;BR /&gt;OK, so lets consider only the initial character in each field:&lt;BR /&gt;&lt;BR /&gt;# awk 'NF!=2||$1!~/^[0-9]/||$2~/^[0-9]/{print;exit 1}' file&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Wed, 21 Mar 2007 07:45:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/awk/m-p/5034948#M95279</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2007-03-21T07:45:39Z</dc:date>
    </item>
    <item>
      <title>Re: awk</title>
      <link>https://community.hpe.com/t5/operating-system-linux/awk/m-p/5034949#M95280</link>
      <description>James&lt;BR /&gt;&lt;BR /&gt;One thing though, it should also fail with the following:&lt;BR /&gt;&lt;BR /&gt;1111111111 myhost100&lt;BR /&gt;&lt;BR /&gt;Notice that the first field doesn't have dots.&lt;BR /&gt;</description>
      <pubDate>Thu, 22 Mar 2007 00:02:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/awk/m-p/5034949#M95280</guid>
      <dc:creator>maliaka</dc:creator>
      <dc:date>2007-03-22T00:02:40Z</dc:date>
    </item>
    <item>
      <title>Re: awk</title>
      <link>https://community.hpe.com/t5/operating-system-linux/awk/m-p/5034950#M95281</link>
      <description>&amp;gt;I would like to add this one to the same awk statement so that I'll have only one line of awk commands.&lt;BR /&gt;&lt;BR /&gt;Do you really want something that confusing?&lt;BR /&gt;&lt;BR /&gt;&amp;gt;One thing though, it should also fail with the following:&lt;BR /&gt;1111111111 myhost100&lt;BR /&gt;&amp;gt;Notice that the first field doesn't have dots.&lt;BR /&gt;&lt;BR /&gt;Perhaps you need to write a program in awk.  I suppose you could have a ERE that would have 3 dots in it, otherwise you could put more checks in your awk script.&lt;BR /&gt;awk '$1 !~ /^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$/ || $2 !~ /^[a-zA-Z0-9]+$/ {print;exit 1}'&lt;BR /&gt;&lt;BR /&gt;Above it looks for 3 ".".  (I couldn't use the \{3\} syntax to have groups of "###.".)</description>
      <pubDate>Thu, 22 Mar 2007 02:54:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/awk/m-p/5034950#M95281</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2007-03-22T02:54:32Z</dc:date>
    </item>
    <item>
      <title>Re: awk</title>
      <link>https://community.hpe.com/t5/operating-system-linux/awk/m-p/5034951#M95282</link>
      <description>James and Dennis are both good solutions.&lt;BR /&gt;Thanks to both of you.&lt;BR /&gt;</description>
      <pubDate>Tue, 27 Mar 2007 22:43:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/awk/m-p/5034951#M95282</guid>
      <dc:creator>maliaka</dc:creator>
      <dc:date>2007-03-27T22:43:25Z</dc:date>
    </item>
  </channel>
</rss>

