<?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: shell script help in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/5267136#M655462</link>
    <description>James,&lt;BR /&gt;Thank you...yes i want extracted is the groups of lines beginning with "811" and ending with "819" so this means I will produced may files from my orginal_file BUT&lt;BR /&gt;&lt;BR /&gt;perl -ne '/^811/../^819/ my_orginal_file&lt;BR /&gt;&lt;BR /&gt;not worked!!! Did I do anything wrong?</description>
    <pubDate>Mon, 20 Dec 2010 14:19:45 GMT</pubDate>
    <dc:creator>Cem Tugrul</dc:creator>
    <dc:date>2010-12-20T14:19:45Z</dc:date>
    <item>
      <title>shell script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/5267133#M655459</link>
      <description>Hello Forum,&lt;BR /&gt;&lt;BR /&gt;i have to manipulate many files which rows (cat -vn) always change.But what i have to do;&lt;BR /&gt;&lt;BR /&gt;1 -All these files start (first records start with 811)&lt;BR /&gt;&lt;BR /&gt;2- it is like an array when starts with 811*&lt;BR /&gt;then must end with an another record 819*&lt;BR /&gt;&lt;BR /&gt;so this means this is a meaningfull record THEN I have to produce a random file from the original file...Here is an example;&lt;BR /&gt;&lt;BR /&gt;My original_file records like;&lt;BR /&gt;&lt;BR /&gt;811020000060810000056970000100001101213                    DE811125281&lt;BR /&gt;8120201202504101213000000000000000000001716909789501202504000   0000000171690&lt;BR /&gt;8130105077820101213     00    B80037      00000000000000000000000000                                                   000104275&lt;BR /&gt;8140381.06225-6007         81062256007           00000000970009900000000017700000000171690   004 0000Y000010        B80037&lt;BR /&gt;819030000001000000100000010000001000000100000001716900000000171690000000000000000000000000000000000000000000000&lt;BR /&gt;811020000060810000056970000100001101213                    DE811125281&lt;BR /&gt;8120201202511101213000000000000000000001807509789501202511000   0000000180750&lt;BR /&gt;8130105077819101213     00    B80037      00000000000000000000000000                                                   000090000&lt;BR /&gt;8140381.15205-5307         81152055307           00000000150009900000000120500000000180750   004 0000Y000010        B80037&lt;BR /&gt;819030000001000000100000010000001000000100000001807500000000180750000000000000000000000000000000000000000000000&lt;BR /&gt;811020000060810000056970000100001101213                    DE811125281&lt;BR /&gt;8120201202506101213000000000000000000004044309789501202506000   0000000404430&lt;BR /&gt;8130105077815101213     00    B80037      00000000000000000000000000                                                   000178500&lt;BR /&gt;8140381.46730-6097         81467306097           00000000170009900000000237900000000404430   004 0000Y000010        B80037&lt;BR /&gt;819030000001000000100000010000001000000100000004044300000000404430000000000000000000000000000000000000000000000&lt;BR /&gt;811020000060810000056970000100001101213                    DE811125281&lt;BR /&gt;8120201202505101213000000000000000000000019909789501202505000   0000000001990&lt;BR /&gt;8130105077821101213     00    B80037      00000000000000000000000000                                                   000000725&lt;BR /&gt;8140382.97485-0825         82974850825           00000000050009900000000003980000000001990   AT  0000Y000010        B80037&lt;BR /&gt;819030000001000000100000010000001000000100000000019900000000001990000000000000000000000000000000000000000000000&lt;BR /&gt;811020000060810000056970000100001101213                    DE811125281&lt;BR /&gt;8120201202514101213000000000000000000000024549789501202514000   0000000002454&lt;BR /&gt;8130105078047101213     00    B80037      00000000000000000000000000                                                   000000120&lt;BR /&gt;8140381.25503-6471         81255036471           00000000060009900000000004090000000002454   004 0000Y000010        B80037&lt;BR /&gt;819030000001000000100000010000001000000100000000024540000000002454000000000000000000000000000000000000000000000&lt;BR /&gt;&lt;BR /&gt;SO I have to produced a file witha random filename and this file includes records from my orginal file but it smust be like;&lt;BR /&gt;&lt;BR /&gt;811020000060810000056970000100001101213                    DE811125281&lt;BR /&gt;8120201202504101213000000000000000000001716909789501202504000   0000000171690&lt;BR /&gt;8130105077820101213     00    B80037      00000000000000000000000000                                                   000104275&lt;BR /&gt;8140381.06225-6007         81062256007           00000000970009900000000017700000000171690   004 0000Y000010        B80037&lt;BR /&gt;81903000000100000010000001000000100000010000000&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Any suggestions would be appreciated...</description>
      <pubDate>Mon, 20 Dec 2010 13:44:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/5267133#M655459</guid>
      <dc:creator>Cem Tugrul</dc:creator>
      <dc:date>2010-12-20T13:44:12Z</dc:date>
    </item>
    <item>
      <title>Re: shell script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/5267134#M655460</link>
      <description>So another file has to be produced again form my orginal file as below with the records; and so on...&lt;BR /&gt;&lt;BR /&gt;811020000060810000056970000100001101213 DE811125281&lt;BR /&gt;8120201202506101213000000000000000000004044309789501202506000 0000000404430&lt;BR /&gt;8130105077815101213 00 B80037 00000000000000000000000000 000178500&lt;BR /&gt;8140381.46730-6097 81467306097 00000000170009900000000237900000000404430 004 0000Y000010 B80037&lt;BR /&gt;819030000001000000100000010000001000000100000004044300000000404430000000000000000000000000000000000000000000000</description>
      <pubDate>Mon, 20 Dec 2010 13:50:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/5267134#M655460</guid>
      <dc:creator>Cem Tugrul</dc:creator>
      <dc:date>2010-12-20T13:50:22Z</dc:date>
    </item>
    <item>
      <title>Re: shell script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/5267135#M655461</link>
      <description>Hi Cem:&lt;BR /&gt;&lt;BR /&gt;If what you want extracted is the groups of lines beginning with "811" and ending with "819" you could do:&lt;BR /&gt;&lt;BR /&gt;# perl -ne '/^811/../^819/ and print' file&lt;BR /&gt;&lt;BR /&gt;If you want only the first group matching this range, do:&lt;BR /&gt;&lt;BR /&gt;# perl -ne '?^811?..?^819? and print'  file&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Mon, 20 Dec 2010 14:05:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/5267135#M655461</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2010-12-20T14:05:03Z</dc:date>
    </item>
    <item>
      <title>Re: shell script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/5267136#M655462</link>
      <description>James,&lt;BR /&gt;Thank you...yes i want extracted is the groups of lines beginning with "811" and ending with "819" so this means I will produced may files from my orginal_file BUT&lt;BR /&gt;&lt;BR /&gt;perl -ne '/^811/../^819/ my_orginal_file&lt;BR /&gt;&lt;BR /&gt;not worked!!! Did I do anything wrong?</description>
      <pubDate>Mon, 20 Dec 2010 14:19:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/5267136#M655462</guid>
      <dc:creator>Cem Tugrul</dc:creator>
      <dc:date>2010-12-20T14:19:45Z</dc:date>
    </item>
    <item>
      <title>Re: shell script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/5267137#M655463</link>
      <description>I want to produce many files from my orginal_file starts with 811 and ends 819(with end of line 819)&lt;BR /&gt;</description>
      <pubDate>Mon, 20 Dec 2010 14:25:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/5267137#M655463</guid>
      <dc:creator>Cem Tugrul</dc:creator>
      <dc:date>2010-12-20T14:25:12Z</dc:date>
    </item>
    <item>
      <title>Re: shell script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/5267138#M655464</link>
      <description>Hi (again):&lt;BR /&gt;&lt;BR /&gt;&amp;gt; yes i want extracted is the groups of lines beginning with "811" and ending with "819" so this means I will produced may files from my orginal_file BUT ...&lt;BR /&gt;&lt;BR /&gt;Since you don't have anything other than successive ranges in your original input you could do:&lt;BR /&gt;&lt;BR /&gt;# perl -ne 'if (?^811?..?^819?) {print};reset,print "\n" if /^819/' file&lt;BR /&gt;&lt;BR /&gt;This would inject a blank line between the ranges.  Is that your objective?&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Mon, 20 Dec 2010 14:37:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/5267138#M655464</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2010-12-20T14:37:49Z</dc:date>
    </item>
    <item>
      <title>Re: shell script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/5267139#M655465</link>
      <description>My original file Ok from your command;&lt;BR /&gt;perl -ne 'if (?^811?..?^819?) {print};reset,print "\n" if /^819/' my_orignal_file&lt;BR /&gt;&lt;BR /&gt;BUT this time i need i want to write out these records to new files.That's what i want.&lt;BR /&gt;&lt;BR /&gt;From your command the output is seen;&lt;BR /&gt;&lt;BR /&gt;811020000060810000056970000100001101213                    DE811125281&lt;BR /&gt;8120201202504101213000000000000000000001716909789501202504000   0000000171690&lt;BR /&gt;8130105077820101213     00    B80037      00000000000000000000000000                                                   000104275&lt;BR /&gt;8140381.06225-6007         81062256007           00000000970009900000000017700000000171690   004 0000Y000010        B80037&lt;BR /&gt;819030000001000000100000010000001000000100000001716900000000171690000000000000000000000000000000000000000000000&lt;BR /&gt;&lt;BR /&gt;811020000060810000056970000100001101213                    DE811125281&lt;BR /&gt;8120201202511101213000000000000000000001807509789501202511000   0000000180750&lt;BR /&gt;8130105077819101213     00    B80037      00000000000000000000000000                                                   000090000&lt;BR /&gt;8140381.15205-5307         81152055307           00000000150009900000000120500000000180750   004 0000Y000010        B80037&lt;BR /&gt;819030000001000000100000010000001000000100000001807500000000180750000000000000000000000000000000000000000000000&lt;BR /&gt;&lt;BR /&gt;811020000060810000056970000100001101213                    DE811125281&lt;BR /&gt;8120201202506101213000000000000000000004044309789501202506000   0000000404430&lt;BR /&gt;8130105077815101213     00    B80037      00000000000000000000000000                                                   000178500&lt;BR /&gt;8140381.46730-6097         81467306097           00000000170009900000000237900000000404430   004 0000Y000010        B80037&lt;BR /&gt;819030000001000000100000010000001000000100000004044300000000404430000000000000000000000000000000000000000000000&lt;BR /&gt;&lt;BR /&gt;811020000060810000056970000100001101213                    DE811125281&lt;BR /&gt;8120201202505101213000000000000000000000019909789501202505000   0000000001990&lt;BR /&gt;8130105077821101213     00    B80037      00000000000000000000000000                                                   000000725&lt;BR /&gt;8140382.97485-0825         82974850825           00000000050009900000000003980000000001990   AT  0000Y000010        B80037&lt;BR /&gt;819030000001000000100000010000001000000100000000019900000000001990000000000000000000000000000000000000000000000&lt;BR /&gt;&lt;BR /&gt;811020000060810000056970000100001101213                    DE811125281&lt;BR /&gt;8120201202514101213000000000000000000000024549789501202514000   0000000002454&lt;BR /&gt;8130105078047101213     00    B80037      00000000000000000000000000                                                   000000120&lt;BR /&gt;8140381.25503-6471         81255036471           00000000060009900000000004090000000002454   004 0000Y000010        B80037&lt;BR /&gt;819030000001000000100000010000001000000100000000024540000000002454000000000000000000000000000000000000000000000&lt;BR /&gt;&lt;BR /&gt;AND GOES ON...But i need that each [811-819] block has to be &amp;gt;&amp;gt; a new filename</description>
      <pubDate>Mon, 20 Dec 2010 14:46:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/5267139#M655465</guid>
      <dc:creator>Cem Tugrul</dc:creator>
      <dc:date>2010-12-20T14:46:58Z</dc:date>
    </item>
    <item>
      <title>Re: shell script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/5267140#M655466</link>
      <description>&lt;!--!*#--&gt;Hi (abain):&lt;BR /&gt;&lt;BR /&gt;&amp;gt; But i need that each [811-819] block has to be &amp;gt;&amp;gt; a new filename &lt;BR /&gt;&lt;BR /&gt;Oh, OK, that's easily done.  Try this:&lt;BR /&gt;&lt;BR /&gt;# cat ./rangedivide&lt;BR /&gt;#!/usr/bin/perl&lt;BR /&gt;use strict;&lt;BR /&gt;use warnings;&lt;BR /&gt;my ( $fh, $file, $nbr );&lt;BR /&gt;$file = "myoutput";&lt;BR /&gt;$nbr  = 1;&lt;BR /&gt;while (&amp;lt;&amp;gt;) {&lt;BR /&gt;    if (?^811?..?^819?) {&lt;BR /&gt;        if (/^811/) {&lt;BR /&gt;            open( $fh, '&amp;gt;', "$file.$nbr" ) or die;&lt;BR /&gt;        }&lt;BR /&gt;        print $fh $_;&lt;BR /&gt;    }&lt;BR /&gt;    if (/^819/) {&lt;BR /&gt;        close $fh;&lt;BR /&gt;        reset;&lt;BR /&gt;        $nbr++;&lt;BR /&gt;    }&lt;BR /&gt;}&lt;BR /&gt;1;&lt;BR /&gt;&lt;BR /&gt;...run as :&lt;BR /&gt;&lt;BR /&gt;# ./rangedivide file&lt;BR /&gt;&lt;BR /&gt;As written, your output file(s) will be named "myoutput.n" where 'n' ranges from one to the number of ranges seen.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Mon, 20 Dec 2010 14:53:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/5267140#M655466</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2010-12-20T14:53:41Z</dc:date>
    </item>
    <item>
      <title>Re: shell script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/5267141#M655467</link>
      <description>./rangedivide.sh: 0403-057 Syntax error at line 1 : `(' is not expected.</description>
      <pubDate>Mon, 20 Dec 2010 15:12:28 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/5267141#M655467</guid>
      <dc:creator>Cem Tugrul</dc:creator>
      <dc:date>2010-12-20T15:12:28Z</dc:date>
    </item>
    <item>
      <title>Re: shell script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/5267142#M655468</link>
      <description>oppps...sorry..my fault.&lt;BR /&gt;That's what i want.&lt;BR /&gt;Thank you very much....</description>
      <pubDate>Mon, 20 Dec 2010 15:16:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/5267142#M655468</guid>
      <dc:creator>Cem Tugrul</dc:creator>
      <dc:date>2010-12-20T15:16:08Z</dc:date>
    </item>
    <item>
      <title>Re: shell script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/5267143#M655469</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;&amp;gt; ./rangedivide.sh: 0403-057 Syntax error at line 1 : `(' is not expected.&lt;BR /&gt;&lt;BR /&gt;Did you cut-and-paste what I posted?  Also, don't name the script "*.sh".   That infers a shell script as opposed to a Perl one.  If you want to use a file extension, use '*.pl'.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Mon, 20 Dec 2010 15:19:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/5267143#M655469</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2010-12-20T15:19:38Z</dc:date>
    </item>
    <item>
      <title>Re: shell script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/5267144#M655470</link>
      <description>Thank's so much James...</description>
      <pubDate>Mon, 20 Dec 2010 15:23:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/5267144#M655470</guid>
      <dc:creator>Cem Tugrul</dc:creator>
      <dc:date>2010-12-20T15:23:12Z</dc:date>
    </item>
    <item>
      <title>Re: shell script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/5267145#M655471</link>
      <description>&lt;!--!*#--&gt;&amp;gt; [...] That infers a shell script [...]&lt;BR /&gt;&lt;BR /&gt;No, it implies a shell script.  _You_ might&lt;BR /&gt;infer that it's a shell script.  (But what's&lt;BR /&gt;in the file matters more than the name in&lt;BR /&gt;this case.)</description>
      <pubDate>Mon, 20 Dec 2010 16:20:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/5267145#M655471</guid>
      <dc:creator>Steven Schweda</dc:creator>
      <dc:date>2010-12-20T16:20:07Z</dc:date>
    </item>
    <item>
      <title>Re: shell script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/5267146#M655472</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;@Steven: &amp;gt; [...] That infers a shell script [...]&lt;BR /&gt;No, it implies a shell script.&lt;BR /&gt;&lt;BR /&gt;Well, there is the usage notes for the word 'infer' here:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://dictionary.reference.com/browse/infer" target="_blank"&gt;http://dictionary.reference.com/browse/infer&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;But then this would buttress your suggested distinction :-)&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://www.wsu.edu/~brians/errors/imply.html" target="_blank"&gt;http://www.wsu.edu/~brians/errors/imply.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Mon, 20 Dec 2010 17:00:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/5267146#M655472</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2010-12-20T17:00:31Z</dc:date>
    </item>
  </channel>
</rss>

