<?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: Pattern Search Fixed width Position in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/pattern-search-fixed-width-position/m-p/3202228#M792489</link>
    <description>#!/usr/bin/perl&lt;BR /&gt;#&lt;BR /&gt;open(ORIGfileptr,"&amp;lt; ORIGFILE");&lt;BR /&gt;open(OUToneFileptr,"&amp;gt; file1");&lt;BR /&gt;open(OUTtwoFileptr,"&amp;gt; file2");&lt;BR /&gt;while (&lt;ORIGFILEPTR&gt;) {&lt;BR /&gt;   if ( m/^([0-9]{9})sugar(.*$)/ ) {&lt;BR /&gt;      printf OUToneFileptr $_;&lt;BR /&gt;   } else {&lt;BR /&gt;      printf OUTtwoFileptr $_;&lt;BR /&gt;   }&lt;BR /&gt;}&lt;BR /&gt;close(ORIGfileptr);&lt;BR /&gt;close(OUToneFileptr);&lt;BR /&gt;close(OUTtwoFileptr);&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;change ORIGFILE (on the open line (the one in quotes)) to the real file name.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;live free or die&lt;BR /&gt;harry&lt;/ORIGFILEPTR&gt;</description>
    <pubDate>Wed, 25 Feb 2004 14:35:06 GMT</pubDate>
    <dc:creator>harry d brown jr</dc:creator>
    <dc:date>2004-02-25T14:35:06Z</dc:date>
    <item>
      <title>Pattern Search Fixed width Position</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/pattern-search-fixed-width-position/m-p/3202226#M792487</link>
      <description>Record length is 820 Characters fixed width position with 2 million rows ///&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;112223333sugar458696963&lt;BR /&gt;125632233water4589sugar&lt;BR /&gt;125632233people63336666&lt;BR /&gt;&lt;BR /&gt;Output would be something like this &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Output:&lt;BR /&gt;&lt;BR /&gt;File 1 &lt;BR /&gt;-------&lt;BR /&gt;112223333sugar4586969633  &lt;BR /&gt;&lt;BR /&gt;File 2 &lt;BR /&gt;-------&lt;BR /&gt;125632233water45869sugar&lt;BR /&gt;125632233people633366666&lt;BR /&gt;</description>
      <pubDate>Wed, 25 Feb 2004 13:45:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/pattern-search-fixed-width-position/m-p/3202226#M792487</guid>
      <dc:creator>lnair</dc:creator>
      <dc:date>2004-02-25T13:45:08Z</dc:date>
    </item>
    <item>
      <title>Re: Pattern Search Fixed width Position</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/pattern-search-fixed-width-position/m-p/3202227#M792488</link>
      <description>If you use the command line it will take TWO passes through the data:&lt;BR /&gt;&lt;BR /&gt;# grep "^\([0-9]\{9\}\)sugar\(.*$\)" testfile1 &amp;gt; outfile1&lt;BR /&gt;# grep -v -f outfile1 testfile1&lt;BR /&gt;125632233water4589sugar&lt;BR /&gt;125632233people63336666&lt;BR /&gt;# grep -v -f outfile1 testfile1 &amp;gt; outfile2&lt;BR /&gt;# cat outfile1&lt;BR /&gt;112223333sugar458696963&lt;BR /&gt;# cat outfile2                            &lt;BR /&gt;125632233water4589sugar&lt;BR /&gt;125632233people63336666&lt;BR /&gt;# cat testfile1                                          &lt;BR /&gt;112223333sugar458696963&lt;BR /&gt;125632233water4589sugar&lt;BR /&gt;125632233people63336666&lt;BR /&gt;# grep "^\([0-9]\{9\}\)sugar\(.*$\)" testfile1 &amp;gt; outfile1&lt;BR /&gt;# grep -v -f outfile1 testfile1 &amp;gt; outfile2               &lt;BR /&gt;# cat outfile1                                           &lt;BR /&gt;112223333sugar458696963&lt;BR /&gt;# cat outfile2&lt;BR /&gt;125632233water4589sugar&lt;BR /&gt;125632233people63336666&lt;BR /&gt;# &lt;BR /&gt;&lt;BR /&gt;Because it requires TWO passes and a LOT of OVERHEAD, I suggest you write a perl script to do it.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;live free or die&lt;BR /&gt;harry</description>
      <pubDate>Wed, 25 Feb 2004 14:29:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/pattern-search-fixed-width-position/m-p/3202227#M792488</guid>
      <dc:creator>harry d brown jr</dc:creator>
      <dc:date>2004-02-25T14:29:43Z</dc:date>
    </item>
    <item>
      <title>Re: Pattern Search Fixed width Position</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/pattern-search-fixed-width-position/m-p/3202228#M792489</link>
      <description>#!/usr/bin/perl&lt;BR /&gt;#&lt;BR /&gt;open(ORIGfileptr,"&amp;lt; ORIGFILE");&lt;BR /&gt;open(OUToneFileptr,"&amp;gt; file1");&lt;BR /&gt;open(OUTtwoFileptr,"&amp;gt; file2");&lt;BR /&gt;while (&lt;ORIGFILEPTR&gt;) {&lt;BR /&gt;   if ( m/^([0-9]{9})sugar(.*$)/ ) {&lt;BR /&gt;      printf OUToneFileptr $_;&lt;BR /&gt;   } else {&lt;BR /&gt;      printf OUTtwoFileptr $_;&lt;BR /&gt;   }&lt;BR /&gt;}&lt;BR /&gt;close(ORIGfileptr);&lt;BR /&gt;close(OUToneFileptr);&lt;BR /&gt;close(OUTtwoFileptr);&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;change ORIGFILE (on the open line (the one in quotes)) to the real file name.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;live free or die&lt;BR /&gt;harry&lt;/ORIGFILEPTR&gt;</description>
      <pubDate>Wed, 25 Feb 2004 14:35:06 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/pattern-search-fixed-width-position/m-p/3202228#M792489</guid>
      <dc:creator>harry d brown jr</dc:creator>
      <dc:date>2004-02-25T14:35:06Z</dc:date>
    </item>
    <item>
      <title>Re: Pattern Search Fixed width Position</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/pattern-search-fixed-width-position/m-p/3202229#M792490</link>
      <description>I do not understand your question. Maybe you can clarify a little bit.&lt;BR /&gt;&lt;BR /&gt;* What is the criterion to put a line in file 1 or file 2? The first number (9 digits)?&lt;BR /&gt;* Only 2 output files?&lt;BR /&gt;&lt;BR /&gt;JP.</description>
      <pubDate>Wed, 25 Feb 2004 14:53:29 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/pattern-search-fixed-width-position/m-p/3202229#M792490</guid>
      <dc:creator>Jeroen Peereboom</dc:creator>
      <dc:date>2004-02-25T14:53:29Z</dc:date>
    </item>
    <item>
      <title>Re: Pattern Search Fixed width Position</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/pattern-search-fixed-width-position/m-p/3202230#M792491</link>
      <description>Thanks for the Suggestion; &lt;BR /&gt;&lt;BR /&gt;However I was looking for an slightly  different answer; to be precise, Pattern "Sugar" could be anything (non empty characters); &lt;BR /&gt;&lt;BR /&gt;So basically the comparison would be something like this For instance(from position 10-14 non-empty characters spooled to 1 file and rest empty characters spooled to 2 file )&lt;BR /&gt; &lt;BR /&gt;&lt;BR /&gt;112223333sugar458696963&lt;BR /&gt;125632233water4589sugar&lt;BR /&gt;125632233people63336666</description>
      <pubDate>Wed, 25 Feb 2004 15:09:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/pattern-search-fixed-width-position/m-p/3202230#M792491</guid>
      <dc:creator>lnair</dc:creator>
      <dc:date>2004-02-25T15:09:46Z</dc:date>
    </item>
    <item>
      <title>Re: Pattern Search Fixed width Position</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/pattern-search-fixed-width-position/m-p/3202231#M792492</link>
      <description>#!/usr/bin/perl&lt;BR /&gt;#&lt;BR /&gt;open(ORIGfileptr,"&amp;lt; ORIGFILE");&lt;BR /&gt;open(OUToneFileptr,"&amp;gt; file1");&lt;BR /&gt;open(OUTtwoFileptr,"&amp;gt; file2");&lt;BR /&gt;while (&lt;ORIGFILEPTR&gt;) {&lt;BR /&gt;if ( m/^([0-9]{9})([A-Za-z]{5})(.*$)/ ) {&lt;BR /&gt;printf OUToneFileptr $_;&lt;BR /&gt;} else {&lt;BR /&gt;printf OUTtwoFileptr $_;&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;close(ORIGfileptr);&lt;BR /&gt;close(OUToneFileptr);&lt;BR /&gt;close(OUTtwoFileptr);&lt;BR /&gt;&lt;BR /&gt;The change says that any ALPHA string five characters long in positions 10-14, go to "file1", all others go to "file2".&lt;BR /&gt;&lt;BR /&gt;TO SHOW SPACES in your examples, use the "+" sign.&lt;BR /&gt;&lt;BR /&gt;live free or die&lt;BR /&gt;harry&lt;/ORIGFILEPTR&gt;</description>
      <pubDate>Wed, 25 Feb 2004 15:17:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/pattern-search-fixed-width-position/m-p/3202231#M792492</guid>
      <dc:creator>harry d brown jr</dc:creator>
      <dc:date>2004-02-25T15:17:31Z</dc:date>
    </item>
  </channel>
</rss>

