<?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 get two lines ... in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/how-get-two-lines/m-p/4755860#M656887</link>
    <description>thank you so much   :)   .... i will work hard on this to avoid asking ....&lt;BR /&gt;&lt;BR /&gt;also, i want to evaluate if $4 or $5 are different ....  how can i do that, i try this it did not work ...&lt;BR /&gt;&lt;BR /&gt;;if ($4!=A[4])||($5!=A[5])  {print "chown "$4":"$5,$2&lt;BR /&gt;&lt;BR /&gt;;if ($4!=A[4])or($5!=A[5])  {print "chown "$4":"$5,$2&lt;BR /&gt;&lt;BR /&gt;please help :0]&lt;BR /&gt;</description>
    <pubDate>Mon, 21 Feb 2011 19:01:07 GMT</pubDate>
    <dc:creator>Manuales</dc:creator>
    <dc:date>2011-02-21T19:01:07Z</dc:date>
    <item>
      <title>how get two lines ...</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-get-two-lines/m-p/4755841#M656868</link>
      <description>Hi all ..&lt;BR /&gt;this is the scenario .. i have a files whit this information &lt;BR /&gt;&lt;BR /&gt;cat information.txt&lt;BR /&gt;&lt;BR /&gt;uno- this is a cat&lt;BR /&gt;dos- this is a dog&lt;BR /&gt;&lt;BR /&gt;uno- this is a cat&lt;BR /&gt;dos- this is a duck&lt;BR /&gt;&lt;BR /&gt;uno- this is a cat&lt;BR /&gt;dos- this is a cat&lt;BR /&gt;&lt;BR /&gt;uno- this is a dog&lt;BR /&gt;dos- this is a cat&lt;BR /&gt;&lt;BR /&gt;uno- this is a duck&lt;BR /&gt;dos- this is a pig&lt;BR /&gt; &lt;BR /&gt;uno- this is a pig&lt;BR /&gt;dos- this is a pig&lt;BR /&gt;&lt;BR /&gt;I need  to compare both lines toguehter.&lt;BR /&gt;if you see they are separated by a line, i need to see if the column 5 is the same or not for each two lines, how can i do that?&lt;BR /&gt;&lt;BR /&gt;how can i get the lines uno- dos- after one line ?&lt;BR /&gt;&lt;BR /&gt;i mean i need to get first:&lt;BR /&gt;&lt;BR /&gt;uno- this is a cat&lt;BR /&gt;dos- this is a dog&lt;BR /&gt;how can i get them?&lt;BR /&gt;after i need to compare the column 5 , i know how to do that&lt;BR /&gt;then after a white line i need to get these lines ...&lt;BR /&gt;uno- this is a cat&lt;BR /&gt;dos- this is a duck&lt;BR /&gt;&lt;BR /&gt;and go on ..&lt;BR /&gt;please let me know...&lt;BR /&gt;i think i can do it with awk, i do not know how exactly to use it to get the information as i need it ..&lt;BR /&gt;&lt;BR /&gt;thanks in advace.&lt;BR /&gt;Manuales.</description>
      <pubDate>Mon, 21 Feb 2011 14:22:55 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-get-two-lines/m-p/4755841#M656868</guid>
      <dc:creator>Manuales</dc:creator>
      <dc:date>2011-02-21T14:22:55Z</dc:date>
    </item>
    <item>
      <title>Re: how get two lines ...</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-get-two-lines/m-p/4755842#M656869</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;# awk 'NF==0 {next};{getline LINE;split(LINE,A);if ($5==A[5]) {print $0"\n"LINE}}' file&lt;BR /&gt;uno- this is a cat&lt;BR /&gt;dos- this is a cat&lt;BR /&gt;uno- this is a pig&lt;BR /&gt;dos- this is a pig&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;BR /&gt;</description>
      <pubDate>Mon, 21 Feb 2011 15:02:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-get-two-lines/m-p/4755842#M656869</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2011-02-21T15:02:30Z</dc:date>
    </item>
    <item>
      <title>Re: how get two lines ...</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-get-two-lines/m-p/4755843#M656870</link>
      <description>thanks James&lt;BR /&gt;&lt;BR /&gt;how can i stop the first two lines to get the value of the column 3 ... and then stop for the other 2 and go on ..?</description>
      <pubDate>Mon, 21 Feb 2011 15:30:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-get-two-lines/m-p/4755843#M656870</guid>
      <dc:creator>Manuales</dc:creator>
      <dc:date>2011-02-21T15:30:59Z</dc:date>
    </item>
    <item>
      <title>Re: how get two lines ...</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-get-two-lines/m-p/4755844#M656871</link>
      <description>Hi (again) Manuales:&lt;BR /&gt;&lt;BR /&gt;&amp;gt; how can i stop the first two lines to get the value of the column 3 ... and then stop for the other 2 and go on ..?&lt;BR /&gt;&lt;BR /&gt;I'm not sure I understand what you are asking.  If you want the third field and not the fifth, the logic would look like:&lt;BR /&gt;&lt;BR /&gt;# awk 'NF==0 {next};{getline LINE;split(LINE,A);if ($3==A[3]) {print $0"\n"LINE}}'&lt;BR /&gt;&lt;BR /&gt;This code skips blank lines (i.e those that have no fields: NF==0).  Otherwise, we have the first line we want in '$0'.  The next LINE is fetched with 'getline' into the 'LINE' variable.  Since 'getline' doesn't do auto-field-spliiting, we do it with a 'split' ourselves.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;..JRF...</description>
      <pubDate>Mon, 21 Feb 2011 15:41:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-get-two-lines/m-p/4755844#M656871</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2011-02-21T15:41:53Z</dc:date>
    </item>
    <item>
      <title>Re: how get two lines ...</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-get-two-lines/m-p/4755845#M656872</link>
      <description>i mean&lt;BR /&gt;&lt;BR /&gt;for .....&lt;BR /&gt;what you told me:&lt;BR /&gt;awk 'NF==0 {next};{getline LINE;split(LINE,A);if ($5==A[5]) {print $0"\n"LINE}}' file.txt  &lt;BR /&gt;&lt;BR /&gt;a=column 5 from uno-&lt;BR /&gt;b=column 5 form dos_&lt;BR /&gt;&lt;BR /&gt;if [[ $a = $b ]]&lt;BR /&gt;then&lt;BR /&gt; echo $ &amp;gt; output.txt&lt;BR /&gt;fi &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;done</description>
      <pubDate>Mon, 21 Feb 2011 15:57:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-get-two-lines/m-p/4755845#M656872</guid>
      <dc:creator>Manuales</dc:creator>
      <dc:date>2011-02-21T15:57:03Z</dc:date>
    </item>
    <item>
      <title>Re: how get two lines ...</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-get-two-lines/m-p/4755846#M656873</link>
      <description>Hi (again) Manuales:&lt;BR /&gt;&lt;BR /&gt;&amp;gt; what you told me:&lt;BR /&gt;&lt;BR /&gt;I don't understand what you are asking.  Did you try running the code I suggested using *your* input as posted; and did it produce the output you wanted?&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Mon, 21 Feb 2011 16:04:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-get-two-lines/m-p/4755846#M656873</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2011-02-21T16:04:59Z</dc:date>
    </item>
    <item>
      <title>Re: how get two lines ...</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-get-two-lines/m-p/4755847#M656874</link>
      <description>ok i will explain better&lt;BR /&gt;&lt;BR /&gt;once i have got the first 2 lines the script has to stop to get the value of the column 5 of the line where appears "uno_" and keep it in a variable a, then the script will get the&lt;BR /&gt;line where appears "dos_" , will keep the value in the variable b, then a and b will be compared, if they are similar $a will be send to an output file ....&lt;BR /&gt;&lt;BR /&gt;then i need to do the same to the other two lines and go on ....&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;until the script has red all the file ..&lt;BR /&gt;</description>
      <pubDate>Mon, 21 Feb 2011 16:07:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-get-two-lines/m-p/4755847#M656874</guid>
      <dc:creator>Manuales</dc:creator>
      <dc:date>2011-02-21T16:07:35Z</dc:date>
    </item>
    <item>
      <title>Re: how get two lines ...</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-get-two-lines/m-p/4755848#M656875</link>
      <description>yes, i ran the code you gave me and worked i got all the lines i want ..... but i need to code in order to stop each two lines uno_ and dos_ and do what above i wrotte ...  ow can i do that, how can i stop each two lines for being evaluated?</description>
      <pubDate>Mon, 21 Feb 2011 16:09:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-get-two-lines/m-p/4755848#M656875</guid>
      <dc:creator>Manuales</dc:creator>
      <dc:date>2011-02-21T16:09:50Z</dc:date>
    </item>
    <item>
      <title>Re: how get two lines ...</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-get-two-lines/m-p/4755849#M656876</link>
      <description>i think i have to use something like this ..&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;awk 'BEGIN {  }&lt;BR /&gt;  {&lt;BR /&gt;...................&lt;BR /&gt;..................   &lt;BR /&gt;&lt;BR /&gt;  a=`echo $line that contains the word uno_ | cut -d" " -f`&lt;BR /&gt;&lt;BR /&gt;  b=`echo $line that contains the word dos_ | cut -d" " -f`&lt;BR /&gt;&lt;BR /&gt;if [[ $a = $b ]]&lt;BR /&gt;then&lt;BR /&gt;echo $a &amp;gt; output.txt&lt;BR /&gt;fi&lt;BR /&gt;...................&lt;BR /&gt;..................   &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;   }&lt;BR /&gt; }' file &lt;BR /&gt;&lt;BR /&gt;it is a loop of the code you gave me for each two lines uno_ and dos_&lt;BR /&gt;&lt;BR /&gt;space&lt;BR /&gt;&lt;BR /&gt;the the others lines uno_ and dos_&lt;BR /&gt;&lt;BR /&gt;and go on ...&lt;BR /&gt;&lt;BR /&gt;how can i do that?</description>
      <pubDate>Mon, 21 Feb 2011 16:14:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-get-two-lines/m-p/4755849#M656876</guid>
      <dc:creator>Manuales</dc:creator>
      <dc:date>2011-02-21T16:14:39Z</dc:date>
    </item>
    <item>
      <title>Re: how get two lines ...</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-get-two-lines/m-p/4755850#M656877</link>
      <description>Hi Manuales:&lt;BR /&gt;&lt;BR /&gt;&amp;gt; once i have got the first 2 lines the script has to stop to get the value of the column 5 of the line where appears "uno_" and keep it in a variable a, then the script will get the&lt;BR /&gt;line where appears "dos_" , will keep the value in the variable b, then a and b will be compared, if they are similar $a will be send to an output file ....&lt;BR /&gt;&lt;BR /&gt;Look at the 'awk' script I suggested.  You said in your opening comments, "I think I can do it with awk...".&lt;BR /&gt;&lt;BR /&gt;The script I have offered skips blank lines; reads two lines; and "stops" at that point if you want to think of it that way.  The 5th field of one record is compared for equality to the 5th field of the second record just as you have asked.  In the case of the 'awk' records, '$5' is one variable and 'a[5]' is the other.  &lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Mon, 21 Feb 2011 16:22:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-get-two-lines/m-p/4755850#M656877</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2011-02-21T16:22:36Z</dc:date>
    </item>
    <item>
      <title>Re: how get two lines ...</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-get-two-lines/m-p/4755851#M656878</link>
      <description>ok.. what you tell me helps a lot, let me give you more detail:&lt;BR /&gt;&lt;BR /&gt;i have this file called information.txt&lt;BR /&gt;&lt;BR /&gt;uno- Ana has a cat&lt;BR /&gt;dos- Pedro has is a dog&lt;BR /&gt;&lt;BR /&gt;uno- Paulina has a pig&lt;BR /&gt;dos- Jorge has is a pig&lt;BR /&gt;&lt;BR /&gt;uno- Robert has a cat&lt;BR /&gt;dos- Jay has is a pig&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;i want to go first the 2 lines that contain uno_ and dos_&lt;BR /&gt;uno- Ana has a cat&lt;BR /&gt;dos- Pedro has is a dog&lt;BR /&gt;&lt;BR /&gt;if Ana (line that contains word uno_) has the same animal than Pedri (line that contains word dos_)have the same animal the script has to report that in an output file.&lt;BR /&gt;&lt;BR /&gt;then&lt;BR /&gt;the script has to go to the next 2 lines and do the same:&lt;BR /&gt;if Paulina (line that contains word uno_) has the same animal than Jorge(line that contains word dos_)have the same animal the script has to report that in an output file.&lt;BR /&gt;&lt;BR /&gt;until finish to read the file information.txt&lt;BR /&gt;&lt;BR /&gt;at the end i will get an output file&lt;BR /&gt;&lt;BR /&gt;is it more clear?   :)</description>
      <pubDate>Mon, 21 Feb 2011 16:38:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-get-two-lines/m-p/4755851#M656878</guid>
      <dc:creator>Manuales</dc:creator>
      <dc:date>2011-02-21T16:38:53Z</dc:date>
    </item>
    <item>
      <title>Re: how get two lines ...</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-get-two-lines/m-p/4755852#M656879</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;Using your last example, the field representing the animal is field-5 in the "uno" records and field-6 in the "dos" records.  If that is intentional, then:&lt;BR /&gt;&lt;BR /&gt;# awk 'NF==0 {next};{getline LINE;split(LINE,A);if ($5==A[6]) {print $0"\n"LINE}}' file &amp;gt; file.out&lt;BR /&gt;&lt;BR /&gt;# cat file.out&lt;BR /&gt;uno- Paulina has a pig&lt;BR /&gt;dos- Jorge has is a pig&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Mon, 21 Feb 2011 17:02:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-get-two-lines/m-p/4755852#M656879</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2011-02-21T17:02:07Z</dc:date>
    </item>
    <item>
      <title>Re: how get two lines ...</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-get-two-lines/m-p/4755853#M656880</link>
      <description>correct, i have to create a file with that name of animal where those two lines have the same animal ......&lt;BR /&gt;&lt;BR /&gt;if i have this file, how can i do that?&lt;BR /&gt;&lt;BR /&gt;uno- Ana has a cat&lt;BR /&gt;dos- Pedro has is a dog&lt;BR /&gt;&lt;BR /&gt;uno- Paulina has a pig&lt;BR /&gt;dos- Jorge has is a pig&lt;BR /&gt;&lt;BR /&gt;uno- Robert has a cat&lt;BR /&gt;dos- Jay has is a pig&lt;BR /&gt;&lt;BR /&gt;uno- Teresa has a butterfly&lt;BR /&gt;dos- Hector has is a butterly&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;thanks.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 21 Feb 2011 17:29:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-get-two-lines/m-p/4755853#M656880</guid>
      <dc:creator>Manuales</dc:creator>
      <dc:date>2011-02-21T17:29:38Z</dc:date>
    </item>
    <item>
      <title>Re: how get two lines ...</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-get-two-lines/m-p/4755854#M656881</link>
      <description>this is the correct file  (i missed an "f" in the last line")&lt;BR /&gt;&lt;BR /&gt;where do you say "touch &amp;gt; $anmal "&lt;BR /&gt;in theory the script has to create two files with the name pig and butterfly&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;uno- Ana has a cat&lt;BR /&gt;dos- Pedro has is a dog&lt;BR /&gt;&lt;BR /&gt;uno- Paulina has a pig&lt;BR /&gt;dos- Jorge has is a pig&lt;BR /&gt;&lt;BR /&gt;uno- Robert has a cat&lt;BR /&gt;dos- Jay has is a pig&lt;BR /&gt;&lt;BR /&gt;uno- Teresa has a butterfly&lt;BR /&gt;dos- Hector has is a butterfly &lt;BR /&gt;&lt;BR /&gt;thanks.</description>
      <pubDate>Mon, 21 Feb 2011 17:31:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-get-two-lines/m-p/4755854#M656881</guid>
      <dc:creator>Manuales</dc:creator>
      <dc:date>2011-02-21T17:31:43Z</dc:date>
    </item>
    <item>
      <title>Re: how get two lines ...</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-get-two-lines/m-p/4755855#M656882</link>
      <description>I have another scenario with a similar issue:&lt;BR /&gt;&lt;BR /&gt;this is the file with the information:&lt;BR /&gt;&lt;BR /&gt;______&lt;BR /&gt;&lt;BR /&gt;S1: /folder1       lrwxrwxrwt root sys&lt;BR /&gt;S2: /folder1       lr-xr-xr-x bin bin&lt;BR /&gt;&lt;BR /&gt;S1: /folder2        drwxrwxrwx bin bin&lt;BR /&gt;S2: /folder2        dr-xr-xr-x bin bin&lt;BR /&gt;&lt;BR /&gt;S1: /home        drwxrwxrwx decadm sapsys&lt;BR /&gt;S2: /home        drwxr-xr-x root root&lt;BR /&gt;&lt;BR /&gt;S1: /home/user1        drwx------ user3 sapsys&lt;BR /&gt;S2: /home/user1        drwx------ root sapsys&lt;BR /&gt;&lt;BR /&gt;______&lt;BR /&gt;&lt;BR /&gt;S1=server1&lt;BR /&gt;S2=server2&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;i have the correct user and group in server1&lt;BR /&gt;i have to fix the user and group in server2.&lt;BR /&gt;&lt;BR /&gt;for the first 2 lines i have this:&lt;BR /&gt;S1: /folder1       lrwxrwxrwt root sys&lt;BR /&gt;S2: /folder1       lr-xr-xr-x bin bin&lt;BR /&gt;&lt;BR /&gt;For the line where appears "/folder1" and S2: if the column 4  is different &lt;BR /&gt;to the column 4 in line where appears S1: and "/folder1" then the script will send this line in an output file:&lt;BR /&gt;echo "chown root:sys /folder1" &amp;gt;&amp;gt; changeuser.sh&lt;BR /&gt;&lt;BR /&gt;at the end i will run the file  changeuser.sh to change all what is different in S2.&lt;BR /&gt;&lt;BR /&gt;how can i do this?&lt;BR /&gt; &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 21 Feb 2011 17:51:56 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-get-two-lines/m-p/4755855#M656882</guid>
      <dc:creator>Manuales</dc:creator>
      <dc:date>2011-02-21T17:51:56Z</dc:date>
    </item>
    <item>
      <title>Re: how get two lines ...</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-get-two-lines/m-p/4755856#M656883</link>
      <description>i forget to mention, if the group or user is different between line 1 where says S1: and line2 where says S2:  knowing that the line1 where is S1: has the correct user and group  then i should have finally:&lt;BR /&gt;echo "chown root:sys /folder1" &amp;gt;&amp;gt; changeuser.sh&lt;BR /&gt;echo "chown decadm:sapsys /home" &amp;gt;&amp;gt; changeuser.sh&lt;BR /&gt;echo "chown user3:sapsys /home" &amp;gt;&amp;gt; changeuser.sh&lt;BR /&gt;&lt;BR /&gt;cat changeuser.sh&lt;BR /&gt;chown root:sys /folder1&lt;BR /&gt;chown decadm:sapsys /home&lt;BR /&gt;chown user3:sapsys /home</description>
      <pubDate>Mon, 21 Feb 2011 17:57:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-get-two-lines/m-p/4755856#M656883</guid>
      <dc:creator>Manuales</dc:creator>
      <dc:date>2011-02-21T17:57:46Z</dc:date>
    </item>
    <item>
      <title>Re: how get two lines ...</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-get-two-lines/m-p/4755857#M656884</link>
      <description>Hi (again) Manuales:&lt;BR /&gt;&lt;BR /&gt;&amp;gt; in theory the script has to create two files with the name pig and butterfly&lt;BR /&gt;&lt;BR /&gt;Well, you never made that clear at the onset!  That said:&lt;BR /&gt;&lt;BR /&gt;# awk 'NF==0 {next};{getline LINE;split(LINE,A);if ($5==A[6]) {FILE=$5;print $0"\n"LINE&amp;gt;&amp;gt;FILE;close FILE}}' file&lt;BR /&gt;&lt;BR /&gt;...will create output files named for the animal names in your example consisting of the lines with matching entries in two adjacent records of the input file.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Mon, 21 Feb 2011 18:04:04 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-get-two-lines/m-p/4755857#M656884</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2011-02-21T18:04:04Z</dc:date>
    </item>
    <item>
      <title>Re: how get two lines ...</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-get-two-lines/m-p/4755858#M656885</link>
      <description>ok, that is i want .... thank you so much ...&lt;BR /&gt;&lt;BR /&gt;could you help me with the other scnenario?  i want to practice more awk for this kind of things .. thanks...</description>
      <pubDate>Mon, 21 Feb 2011 18:22:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-get-two-lines/m-p/4755858#M656885</guid>
      <dc:creator>Manuales</dc:creator>
      <dc:date>2011-02-21T18:22:16Z</dc:date>
    </item>
    <item>
      <title>Re: how get two lines ...</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-get-two-lines/m-p/4755859#M656886</link>
      <description>Hi Manuales:&lt;BR /&gt;&lt;BR /&gt;&amp;gt; could you help me with the other scnenario?&lt;BR /&gt;&lt;BR /&gt;OK, but this is very similar, so before trying what I am offering, I urge you to *try* and write a solution yourself!&lt;BR /&gt;&lt;BR /&gt;That said, you could do:&lt;BR /&gt;&lt;BR /&gt;# awk 'NF==0 {next};$3~/l/ {next};{getline LINE;split(LINE,A);if ($4!=A[4]) {print "chown "$4":"$5,$2&amp;gt; "changeuser.sh"}}'&lt;BR /&gt;&lt;BR /&gt;Notice that we skip records that specify a symbolic link notation.  That's because the permissions and ownerships of symbolic links don't matter.  It's the object to which the link points that does.&lt;BR /&gt;&lt;BR /&gt;I would also point out that a simple '&amp;gt;' instead of a '&amp;gt;&amp;gt;' suffices in both this script and the one I previously provided.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Mon, 21 Feb 2011 18:44:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-get-two-lines/m-p/4755859#M656886</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2011-02-21T18:44:07Z</dc:date>
    </item>
    <item>
      <title>Re: how get two lines ...</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-get-two-lines/m-p/4755860#M656887</link>
      <description>thank you so much   :)   .... i will work hard on this to avoid asking ....&lt;BR /&gt;&lt;BR /&gt;also, i want to evaluate if $4 or $5 are different ....  how can i do that, i try this it did not work ...&lt;BR /&gt;&lt;BR /&gt;;if ($4!=A[4])||($5!=A[5])  {print "chown "$4":"$5,$2&lt;BR /&gt;&lt;BR /&gt;;if ($4!=A[4])or($5!=A[5])  {print "chown "$4":"$5,$2&lt;BR /&gt;&lt;BR /&gt;please help :0]&lt;BR /&gt;</description>
      <pubDate>Mon, 21 Feb 2011 19:01:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-get-two-lines/m-p/4755860#M656887</guid>
      <dc:creator>Manuales</dc:creator>
      <dc:date>2011-02-21T19:01:07Z</dc:date>
    </item>
  </channel>
</rss>

