<?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 Query in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-query/m-p/3959968#M756672</link>
    <description>Hi Amith:&lt;BR /&gt;&lt;BR /&gt;*IF* you have an Ascii text file, then the following will replace the string of "99" with spaces _only_ when it is in the 79th position (counting the first character as *zero*):&lt;BR /&gt;&lt;BR /&gt;# perl -ple 'substr($_,79,2,"  ") if substr($_,79,2)==99' file&lt;BR /&gt;&lt;BR /&gt;If you count the 79th position from character one, then change the 79-to-78.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;BR /&gt;&lt;BR /&gt;</description>
    <pubDate>Mon, 12 Mar 2007 09:48:13 GMT</pubDate>
    <dc:creator>James R. Ferguson</dc:creator>
    <dc:date>2007-03-12T09:48:13Z</dc:date>
    <item>
      <title>Shell script Query</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-query/m-p/3959965#M756669</link>
      <description>Hello,&lt;BR /&gt;&lt;BR /&gt;I want to replace the value “99” which is in 79th position of a data file to spaces. Can any one help me how to achieve this in a script. It should be done only if the value is 99.&lt;BR /&gt;&lt;BR /&gt;Regards&lt;BR /&gt;Amith</description>
      <pubDate>Mon, 12 Mar 2007 09:26:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-query/m-p/3959965#M756669</guid>
      <dc:creator>Amith_2</dc:creator>
      <dc:date>2007-03-12T09:26:58Z</dc:date>
    </item>
    <item>
      <title>Re: Shell script Query</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-query/m-p/3959966#M756670</link>
      <description>Are the data line-oriented? (i.e each record terminated with a LF or LF/CR pair or is each record fixed-length with no separator. Is this a pure textfile containing no binary data. When you define the problem more precisely, the solutions often are obvious.&lt;BR /&gt;</description>
      <pubDate>Mon, 12 Mar 2007 09:31:33 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-query/m-p/3959966#M756670</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2007-03-12T09:31:33Z</dc:date>
    </item>
    <item>
      <title>Re: Shell script Query</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-query/m-p/3959967#M756671</link>
      <description>&lt;!--!*#--&gt;As Clay says - we need to know the format of the file...&lt;BR /&gt;&lt;BR /&gt;You could try:&lt;BR /&gt;&lt;BR /&gt;cat yourfile | sed 's/99/  /g' &amp;gt; newfile&lt;BR /&gt;&lt;BR /&gt;Rgds...Geoff&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 12 Mar 2007 09:41:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-query/m-p/3959967#M756671</guid>
      <dc:creator>Geoff Wild</dc:creator>
      <dc:date>2007-03-12T09:41:49Z</dc:date>
    </item>
    <item>
      <title>Re: Shell script Query</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-query/m-p/3959968#M756672</link>
      <description>Hi Amith:&lt;BR /&gt;&lt;BR /&gt;*IF* you have an Ascii text file, then the following will replace the string of "99" with spaces _only_ when it is in the 79th position (counting the first character as *zero*):&lt;BR /&gt;&lt;BR /&gt;# perl -ple 'substr($_,79,2,"  ") if substr($_,79,2)==99' file&lt;BR /&gt;&lt;BR /&gt;If you count the 79th position from character one, then change the 79-to-78.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 12 Mar 2007 09:48:13 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-query/m-p/3959968#M756672</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2007-03-12T09:48:13Z</dc:date>
    </item>
    <item>
      <title>Re: Shell script Query</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-query/m-p/3959969#M756673</link>
      <description>&lt;!--!*#--&gt;An awk solution would be:&lt;BR /&gt;awk '{&lt;BR /&gt;if (substr($0, 79, 2) == "99") {&lt;BR /&gt;   $0 = substr($0,1,78) "  " substr($0,81)&lt;BR /&gt;}&lt;BR /&gt;print&lt;BR /&gt;}'&lt;BR /&gt;&lt;BR /&gt;awk allows access to positions beyond the end of a string and returns null.  (awk's substr counts from 1.)</description>
      <pubDate>Mon, 12 Mar 2007 23:03:28 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-query/m-p/3959969#M756673</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2007-03-12T23:03:28Z</dc:date>
    </item>
    <item>
      <title>Re: Shell script Query</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-query/m-p/3959970#M756674</link>
      <description>I am attaching the file which contains a record and i need to change the value 99 starting from 79th position to spaces.&lt;BR /&gt;I tried the commands but none is working</description>
      <pubDate>Tue, 13 Mar 2007 02:11:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-query/m-p/3959970#M756674</guid>
      <dc:creator>Amith_2</dc:creator>
      <dc:date>2007-03-13T02:11:35Z</dc:date>
    </item>
    <item>
      <title>Re: Shell script Query</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-query/m-p/3959971#M756675</link>
      <description>&amp;gt;I am attaching the file which contains a record and i need to change the value 99 starting from 79th position to spaces.&lt;BR /&gt;&lt;BR /&gt;It works according to what you said and we guessed.  How do you number to 79th position?  (JRF asked) Start from 1 or 0?  I assumed 1 and the length was just 2.&lt;BR /&gt;...4999990...&lt;BR /&gt;...499  90...&lt;BR /&gt;&lt;BR /&gt;(Note: My script make a copy to stdout with the changes.)</description>
      <pubDate>Tue, 13 Mar 2007 03:03:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-query/m-p/3959971#M756675</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2007-03-13T03:03:19Z</dc:date>
    </item>
  </channel>
</rss>

