<?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 - script sequence problem? in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-script-sequence-problem/m-p/2855316#M94565</link>
    <description>Jean, I see what you mean!&lt;BR /&gt;&lt;BR /&gt;here is an example file :&lt;BR /&gt;&lt;BR /&gt;ZHV|&lt;BR /&gt;249|1100019210315|20021105|DAN HOWARD.|&lt;BR /&gt;249|1100000348295|20021105|DAN HOWARD.|&lt;BR /&gt;ZPT|&lt;BR /&gt;&lt;BR /&gt;cheers&lt;BR /&gt;John</description>
    <pubDate>Mon, 02 Dec 2002 14:02:27 GMT</pubDate>
    <dc:creator>u856100</dc:creator>
    <dc:date>2002-12-02T14:02:27Z</dc:date>
    <item>
      <title>awk - script sequence problem?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-script-sequence-problem/m-p/2855310#M94559</link>
      <description>Hello,&lt;BR /&gt;&lt;BR /&gt;I have another little annoying niggle in awk.&lt;BR /&gt;&lt;BR /&gt;I can get around the problem, but for future reference, I would like to know why. I have the following script :&lt;BR /&gt;&lt;BR /&gt;run with &lt;BR /&gt;# my_awk_script &lt;FILENAME&gt;&lt;BR /&gt;&lt;BR /&gt;cat $1 | awk -F"|" '&lt;BR /&gt;$1 ~ /^249$/ {printf("%s|%s|%s|%s DAN HOWARD|\n",$1,$2,$3,$4);next}&lt;BR /&gt;/^DAN HOWARD|$/ {next}&lt;BR /&gt;/^Dan Howard|$/ {next}&lt;BR /&gt;{print $0}' &amp;gt;&amp;gt; modD0125_$1&lt;BR /&gt;&lt;BR /&gt;what I am trying to do is make :&lt;BR /&gt;&lt;BR /&gt;ZHV|&lt;BR /&gt;blah blah blah|1234|abcd|zzz,&lt;BR /&gt;DAN HOWARD|&lt;BR /&gt;blah blah blah|5678|efgh|zzz,&lt;BR /&gt;DAN HOWARD|&lt;BR /&gt;ZPT|&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;look like :&lt;BR /&gt;&lt;BR /&gt;ZHV|&lt;BR /&gt;blah blah blah|1234|abcd|zzz, DAN HOWARD|&lt;BR /&gt;blah blah blah|5678|efgh|zzz, DAN HOWARD|&lt;BR /&gt;ZPT|&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;but when I use the above script, awk omits the &lt;IF no="" matches="" above="" then=""&gt;&lt;BR /&gt;{print $0}&lt;BR /&gt;&lt;BR /&gt;and I get the following :&lt;BR /&gt;&lt;BR /&gt;blah blah blah|1234|abcd|zzz, DAN HOWARD|&lt;BR /&gt;blah blah blah|5678|efgh|zzz, DAN HOWARD|&lt;BR /&gt;&lt;BR /&gt;(my header and footer is missing)&lt;BR /&gt;&lt;BR /&gt;but if I use the following, everything works fine.&lt;BR /&gt;&lt;BR /&gt;cat $1 | awk -F"|" '&lt;BR /&gt;$1 ~ /^249$/ {printf("%s|%s|%s|%s DAN HOWARD|\n",$1,$2,$3,$4);next}&lt;BR /&gt;$1 ~ /^ZHV$/ {print $0}&lt;BR /&gt;$1 ~ /^ZPT$/ {print $0}&lt;BR /&gt;/^DAN HOWARD|$/ {next}&lt;BR /&gt;/^Dan Howard|$/ {next}' &amp;gt;&amp;gt; modD0125_$1&lt;BR /&gt;&lt;BR /&gt;it obviously has something to do with the ordering, but I can't see what (do pipe chars need to be escaped?)&lt;BR /&gt;&lt;BR /&gt;any ideas?&lt;BR /&gt;&lt;BR /&gt;thanks in advance!&lt;BR /&gt;John&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/IF&gt;&lt;/FILENAME&gt;</description>
      <pubDate>Mon, 02 Dec 2002 12:43:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-script-sequence-problem/m-p/2855310#M94559</guid>
      <dc:creator>u856100</dc:creator>
      <dc:date>2002-12-02T12:43:20Z</dc:date>
    </item>
    <item>
      <title>Re: awk - script sequence problem?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-script-sequence-problem/m-p/2855311#M94560</link>
      <description>John,&lt;BR /&gt;&lt;BR /&gt;What the .... is this:&lt;BR /&gt;&lt;BR /&gt;$1 ~ /^249$/ &lt;BR /&gt;&lt;BR /&gt;??&lt;BR /&gt;&lt;BR /&gt;Is that a ctrl-249 then a $ sign ??&lt;BR /&gt;&lt;BR /&gt;live free or die&lt;BR /&gt;harry</description>
      <pubDate>Mon, 02 Dec 2002 13:14:37 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-script-sequence-problem/m-p/2855311#M94560</guid>
      <dc:creator>harry d brown jr</dc:creator>
      <dc:date>2002-12-02T13:14:37Z</dc:date>
    </item>
    <item>
      <title>Re: awk - script sequence problem?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-script-sequence-problem/m-p/2855312#M94561</link>
      <description>&lt;BR /&gt;John,&lt;BR /&gt;&lt;BR /&gt;The issue I guess was your listed input of &lt;BR /&gt;&lt;BR /&gt;ZHV|&lt;BR /&gt;blah blah blah|1234|abcd|zzz,&lt;BR /&gt;DAN HOWARD|&lt;BR /&gt;blah blah blah|5678|efgh|zzz,&lt;BR /&gt;DAN HOWARD|&lt;BR /&gt;ZPT| &lt;BR /&gt;&lt;BR /&gt;Which contains no "249"'s.&lt;BR /&gt;&lt;BR /&gt;live free or die&lt;BR /&gt;harry</description>
      <pubDate>Mon, 02 Dec 2002 13:32:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-script-sequence-problem/m-p/2855312#M94561</guid>
      <dc:creator>harry d brown jr</dc:creator>
      <dc:date>2002-12-02T13:32:26Z</dc:date>
    </item>
    <item>
      <title>Re: awk - script sequence problem?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-script-sequence-problem/m-p/2855313#M94562</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;My problem is that it seems to work on my system ... but your test case doesn't match your script (like first field equals 249), so perhaps I made something wrong in my program which makes it work ...&lt;BR /&gt;&lt;BR /&gt;Regards.</description>
      <pubDate>Mon, 02 Dec 2002 13:55:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-script-sequence-problem/m-p/2855313#M94562</guid>
      <dc:creator>Jean-Louis Phelix</dc:creator>
      <dc:date>2002-12-02T13:55:32Z</dc:date>
    </item>
    <item>
      <title>Re: awk - script sequence problem?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-script-sequence-problem/m-p/2855314#M94563</link>
      <description>Hi Harry,&lt;BR /&gt;&lt;BR /&gt;I was using $1 ~ /^249$/ to match the first field ($1) of all rows that start (^) with the numeric 249 only (hence the (^ ....... $) to ensure I only get fields that are 249 alone and not 2491234, etc.&lt;BR /&gt;&lt;BR /&gt;Jean,&lt;BR /&gt;&lt;BR /&gt;Hmm strange, we are on HP-UX 11.00. I am a bit confused as to why it isn't working, It seems to only work one way on my machine (HP 'N' class), nevermind, at least I have a work around,&lt;BR /&gt;&lt;BR /&gt;thanks for your responses guys&lt;BR /&gt;John</description>
      <pubDate>Mon, 02 Dec 2002 14:00:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-script-sequence-problem/m-p/2855314#M94563</guid>
      <dc:creator>u856100</dc:creator>
      <dc:date>2002-12-02T14:00:00Z</dc:date>
    </item>
    <item>
      <title>Re: awk - script sequence problem?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-script-sequence-problem/m-p/2855315#M94564</link>
      <description>John,&lt;BR /&gt;&lt;BR /&gt;If I change your "blah blah blah"'s to 249, then the script works:&lt;BR /&gt;&lt;BR /&gt;# ./tyu uyt&lt;BR /&gt;ZHV|&lt;BR /&gt;249|1234|abcd|zzz, DAN HOWARD|&lt;BR /&gt;249|5678|efgh|zzz, DAN HOWARD|&lt;BR /&gt;ZPT|&lt;BR /&gt;# cat ./tyu uyt&lt;BR /&gt;#!/usr/bin/ksh&lt;BR /&gt;#&lt;BR /&gt;cat $1 | awk -F"|" '&lt;BR /&gt;$1 ~ /^249$/ {printf("%s|%s|%s|%s DAN HOWARD|\n",$1,$2,$3,$4);next}&lt;BR /&gt;/^DAN HOWARD\|$/ {next}&lt;BR /&gt;/^Dan Howard\|$/ {next}&lt;BR /&gt;{print $0}'&lt;BR /&gt;ZHV|&lt;BR /&gt;249|1234|abcd|zzz,&lt;BR /&gt;DAN HOWARD|&lt;BR /&gt;249|5678|efgh|zzz,&lt;BR /&gt;DAN HOWARD|&lt;BR /&gt;ZPT|&lt;BR /&gt;# &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;live free or die&lt;BR /&gt;harry</description>
      <pubDate>Mon, 02 Dec 2002 14:00:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-script-sequence-problem/m-p/2855315#M94564</guid>
      <dc:creator>harry d brown jr</dc:creator>
      <dc:date>2002-12-02T14:00:54Z</dc:date>
    </item>
    <item>
      <title>Re: awk - script sequence problem?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-script-sequence-problem/m-p/2855316#M94565</link>
      <description>Jean, I see what you mean!&lt;BR /&gt;&lt;BR /&gt;here is an example file :&lt;BR /&gt;&lt;BR /&gt;ZHV|&lt;BR /&gt;249|1100019210315|20021105|DAN HOWARD.|&lt;BR /&gt;249|1100000348295|20021105|DAN HOWARD.|&lt;BR /&gt;ZPT|&lt;BR /&gt;&lt;BR /&gt;cheers&lt;BR /&gt;John</description>
      <pubDate>Mon, 02 Dec 2002 14:02:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-script-sequence-problem/m-p/2855316#M94565</guid>
      <dc:creator>u856100</dc:creator>
      <dc:date>2002-12-02T14:02:27Z</dc:date>
    </item>
    <item>
      <title>Re: awk - script sequence problem?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-script-sequence-problem/m-p/2855317#M94566</link>
      <description>John,&lt;BR /&gt;&lt;BR /&gt;that input doesn't work either.&lt;BR /&gt;&lt;BR /&gt;ZHV|&lt;BR /&gt;249|1100019210315|20021105|DAN HOWARD.|&lt;BR /&gt;249|1100000348295|20021105|DAN HOWARD.|&lt;BR /&gt;ZPT| &lt;BR /&gt;&lt;BR /&gt;??&lt;BR /&gt;&lt;BR /&gt;live free or die&lt;BR /&gt;harry</description>
      <pubDate>Mon, 02 Dec 2002 14:05:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-script-sequence-problem/m-p/2855317#M94566</guid>
      <dc:creator>harry d brown jr</dc:creator>
      <dc:date>2002-12-02T14:05:27Z</dc:date>
    </item>
  </channel>
</rss>

