<?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: getline and format in awk in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/getline-and-format-in-awk/m-p/4190201#M91297</link>
    <description>magic,&lt;BR /&gt;&lt;BR /&gt;it works a treat James ...&lt;BR /&gt;&lt;BR /&gt;Thanks again.&lt;BR /&gt;&lt;BR /&gt;Chris. (MORECOFEE)</description>
    <pubDate>Thu, 01 May 2008 11:13:37 GMT</pubDate>
    <dc:creator>lawrenzo</dc:creator>
    <dc:date>2008-05-01T11:13:37Z</dc:date>
    <item>
      <title>getline and format in awk</title>
      <link>https://community.hpe.com/t5/operating-system-linux/getline-and-format-in-awk/m-p/4190198#M91294</link>
      <description>Hello,&lt;BR /&gt;&lt;BR /&gt;I want to search a list of installed files (AIX) and I find that the list is not consistent with $1 being the software and $2 being the version.  Sometimes in the list $2 in on the next line:&lt;BR /&gt;&lt;BR /&gt; ldap.client.adt            5.2.0.0  COMMITTED  Directory Client SDK&lt;BR /&gt;  ldap.client.rte            5.2.0.0  COMMITTED  Directory Client Runtime (No&lt;BR /&gt;                                                 SSL)&lt;BR /&gt;  ldap.max_crypto_client.adt&lt;BR /&gt;                             5.2.0.0  COMMITTED  Directory Client SDK&lt;BR /&gt;  ldap.max_crypto_client.rte&lt;BR /&gt;                             5.2.0.0  COMMITTED  Directory Client Runtime (SSL)&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;so I thought I could solve this using getline which I can if I search the pattern and run the below command:&lt;BR /&gt;&lt;BR /&gt;# lslpp -l |awk '/ldap.max/ {(x = $0);getline;print x,$1}'&lt;BR /&gt;&lt;BR /&gt;  ldap.max_crypto_client.adt 5.2.0.0&lt;BR /&gt;  ldap.max_crypto_client.rte 5.2.0.0&lt;BR /&gt;&lt;BR /&gt;but if I search multiple string and check that if $2 is equal to null I get a strange output:&lt;BR /&gt;&lt;BR /&gt; # lslpp -l |egrep "ldap|gsk"&lt;BR /&gt;  gskak.rte                 6.0.5.41  COMMITTED  AIX Certificate and SSL Base&lt;BR /&gt;  gskta.rte                 7.0.4.14  COMMITTED  AIX Certificate and SSL Base&lt;BR /&gt;  ldap.client.adt            5.2.0.0  COMMITTED  Directory Client SDK&lt;BR /&gt;  ldap.client.rte            5.2.0.0  COMMITTED  Directory Client Runtime (No&lt;BR /&gt;  ldap.max_crypto_client.adt&lt;BR /&gt;  ldap.max_crypto_client.rte&lt;BR /&gt;  ldap.client.rte            5.2.0.0  COMMITTED  Directory Client Runtime (No&lt;BR /&gt;&lt;BR /&gt;# lslpp -l |awk '/ldap|gsk/ {if ($2 == "")(x = $0);getline;print x,$1}'&lt;BR /&gt; Runtime&lt;BR /&gt; Runtime&lt;BR /&gt; ldap.client.rte&lt;BR /&gt;  ldap.max_crypto_client.adt 5.2.0.0&lt;BR /&gt;  ldap.max_crypto_client.rte 5.2.0.0&lt;BR /&gt;  ldap.max_crypto_client.rte SSL)&lt;BR /&gt;&lt;BR /&gt;any ideas?&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;&lt;BR /&gt;Chris</description>
      <pubDate>Thu, 01 May 2008 10:24:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/getline-and-format-in-awk/m-p/4190198#M91294</guid>
      <dc:creator>lawrenzo</dc:creator>
      <dc:date>2008-05-01T10:24:00Z</dc:date>
    </item>
    <item>
      <title>Re: getline and format in awk</title>
      <link>https://community.hpe.com/t5/operating-system-linux/getline-and-format-in-awk/m-p/4190199#M91295</link>
      <description>Hi Chris:&lt;BR /&gt;&lt;BR /&gt;Using your data:&lt;BR /&gt;&lt;BR /&gt;# awk '/ldap|gsk/ {if (NF==1){next} else {print $1,$2}}' file&lt;BR /&gt;gskak.rte 6.0.5.41&lt;BR /&gt;gskta.rte 7.0.4.14&lt;BR /&gt;ldap.client.adt 5.2.0.0&lt;BR /&gt;ldap.client.rte 5.2.0.0&lt;BR /&gt;ldap.client.rte 5.2.0.0&lt;BR /&gt;&lt;BR /&gt;Isn't that what you want?&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Thu, 01 May 2008 10:47:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/getline-and-format-in-awk/m-p/4190199#M91295</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2008-05-01T10:47:46Z</dc:date>
    </item>
    <item>
      <title>Re: getline and format in awk</title>
      <link>https://community.hpe.com/t5/operating-system-linux/getline-and-format-in-awk/m-p/4190200#M91296</link>
      <description>Hi (agaih) Chris:&lt;BR /&gt;&lt;BR /&gt;Sorry, I used the "strange output" from your first approximation as my input.&lt;BR /&gt;&lt;BR /&gt;Using this:&lt;BR /&gt;&lt;BR /&gt;# cat .myinput&lt;BR /&gt;ldap.client.adt 5.2.0.0 COMMITTED Directory Client SDK&lt;BR /&gt;ldap.client.rte 5.2.0.0 COMMITTED Directory Client Runtime (No&lt;BR /&gt;SSL)&lt;BR /&gt;ldap.max_crypto_client.adt&lt;BR /&gt;5.2.0.0 COMMITTED Directory Client SDK&lt;BR /&gt;ldap.max_crypto_client.rte&lt;BR /&gt;5.2.0.0 COMMITTED Directory Client Runtime (SSL)&lt;BR /&gt;&lt;BR /&gt;...and:&lt;BR /&gt;&lt;BR /&gt;# awk '/ldap|gsk/ {if (NF==1){x=$0;getline;print x,$1} else {print $1,$2}}' ./myfile&lt;BR /&gt;ldap.client.adt 5.2.0.0&lt;BR /&gt;ldap.client.rte 5.2.0.0&lt;BR /&gt;ldap.max_crypto_client.adt 5.2.0.0&lt;BR /&gt;ldap.max_crypto_client.rte 5.2.0.0&lt;BR /&gt;&lt;BR /&gt;Regards! [ENOCOFFEE]&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 01 May 2008 11:03:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/getline-and-format-in-awk/m-p/4190200#M91296</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2008-05-01T11:03:25Z</dc:date>
    </item>
    <item>
      <title>Re: getline and format in awk</title>
      <link>https://community.hpe.com/t5/operating-system-linux/getline-and-format-in-awk/m-p/4190201#M91297</link>
      <description>magic,&lt;BR /&gt;&lt;BR /&gt;it works a treat James ...&lt;BR /&gt;&lt;BR /&gt;Thanks again.&lt;BR /&gt;&lt;BR /&gt;Chris. (MORECOFEE)</description>
      <pubDate>Thu, 01 May 2008 11:13:37 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/getline-and-format-in-awk/m-p/4190201#M91297</guid>
      <dc:creator>lawrenzo</dc:creator>
      <dc:date>2008-05-01T11:13:37Z</dc:date>
    </item>
    <item>
      <title>Re: getline and format in awk</title>
      <link>https://community.hpe.com/t5/operating-system-linux/getline-and-format-in-awk/m-p/4190202#M91298</link>
      <description>&amp;gt;{(x = $0);getline;print x,$1}&lt;BR /&gt;&lt;BR /&gt;(I'm not sure why you used ()?)&lt;BR /&gt;&lt;BR /&gt;getline will also let you input into a variable:&lt;BR /&gt;{ getline second; print $0, second }&lt;BR /&gt;&lt;BR /&gt;But I suppose if you want $1, you need to do it your way.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 02 May 2008 07:45:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/getline-and-format-in-awk/m-p/4190202#M91298</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2008-05-02T07:45:49Z</dc:date>
    </item>
  </channel>
</rss>

