<?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: Scripting in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting/m-p/2814575#M85183</link>
    <description>Hi:&lt;BR /&gt;&lt;BR /&gt;OK.  We'll use 'sed' to translate the ,*, strings to a pipe as already done.  At this point is appears that you want to make translations on field number 2, 6, and 9 if I understand correctly.&lt;BR /&gt;&lt;BR /&gt;Hence, pipe the output of the 'sed' to an 'awk' script.  Essentially, we will need to examine fields 2, 6, and 9 for anyone of the conditions you cited and substitute.&lt;BR /&gt;&lt;BR /&gt;Using one of the lines in your file:&lt;BR /&gt;&lt;BR /&gt;IIF     ,*,22I,*,2,*, ,*,OS,*,036R,*, ,*,  ,*,068G,*,   ,*,&lt;BR /&gt;&lt;BR /&gt;...THEN: sed -e 's/,\*,/|/g'&lt;BR /&gt;...produces:&lt;BR /&gt;&lt;BR /&gt;IIF     |22I|2| |OS|036R| |  |068G|   |&lt;BR /&gt;&lt;BR /&gt;...which we pipe to an 'awk' script, the beginnings of which might look like:&lt;BR /&gt;&lt;BR /&gt;awk -F\| 'BEGIN{OFS="|"}; $2~/..I/ {$2="xxx"};$6~/...R/ {$6="yyy"};{print $0}'&lt;BR /&gt;&lt;BR /&gt;...which with the above data would yield:&lt;BR /&gt;&lt;BR /&gt;IIF     |xxx|2| |OS|yyy| |  |068G|   |&lt;BR /&gt;&lt;BR /&gt;...I've used "xxx" and "yyy" for clarity of substitution.  For brevity, I didn't write a complete 'awk' script, only enough to show conceptually my suggestion.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
    <pubDate>Fri, 27 Sep 2002 01:45:00 GMT</pubDate>
    <dc:creator>James R. Ferguson</dc:creator>
    <dc:date>2002-09-27T01:45:00Z</dc:date>
    <item>
      <title>Scripting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting/m-p/2814569#M85177</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;I would like to reformat a file by removing all the ,*, fields from the attached txt file. Your scripting knowledge would be muchly appreciated.</description>
      <pubDate>Thu, 26 Sep 2002 23:50:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting/m-p/2814569#M85177</guid>
      <dc:creator>Arman Mahboobi</dc:creator>
      <dc:date>2002-09-26T23:50:42Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting/m-p/2814570#M85178</link>
      <description>Oh, and also I would like to convert fields&lt;BR /&gt;221 to Q0&lt;BR /&gt;**I to O6 (where * wild)&lt;BR /&gt;***R to O4 (where * wild)&lt;BR /&gt;***G to P1 (where * wild)&lt;BR /&gt;&lt;BR /&gt;Many thanks</description>
      <pubDate>Thu, 26 Sep 2002 23:57:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting/m-p/2814570#M85178</guid>
      <dc:creator>Arman Mahboobi</dc:creator>
      <dc:date>2002-09-26T23:57:25Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting/m-p/2814571#M85179</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;This will remove all occurances of the string comma_asterisk_comma:&lt;BR /&gt;&lt;BR /&gt;# sed -e 's/,\*,//g' filename&lt;BR /&gt;&lt;BR /&gt;Is that what you want?&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Fri, 27 Sep 2002 00:02:33 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting/m-p/2814571#M85179</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2002-09-27T00:02:33Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting/m-p/2814572#M85180</link>
      <description>Sorry, I would like to replace the ,*, fields with a pipe instead of removing it.</description>
      <pubDate>Fri, 27 Sep 2002 00:08:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting/m-p/2814572#M85180</guid>
      <dc:creator>Arman Mahboobi</dc:creator>
      <dc:date>2002-09-27T00:08:00Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting/m-p/2814573#M85181</link>
      <description>Hi Again:&lt;BR /&gt;&lt;BR /&gt;# sed -e 's/,\*,/|/g' filename&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Fri, 27 Sep 2002 00:08:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting/m-p/2814573#M85181</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2002-09-27T00:08:26Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting/m-p/2814574#M85182</link>
      <description>Hi James,&lt;BR /&gt;Thankyou very much for your help.&lt;BR /&gt;Thats getting near to what I need, all I need now is changing the following fields&lt;BR /&gt;22I to Q0 (field 2)&lt;BR /&gt;**I to O6 (field 2 where * is wild)&lt;BR /&gt;***R to O4 (field 6 where * is wild)&lt;BR /&gt;***G to P1 (filed 9 where * is wild)</description>
      <pubDate>Fri, 27 Sep 2002 00:39:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting/m-p/2814574#M85182</guid>
      <dc:creator>Arman Mahboobi</dc:creator>
      <dc:date>2002-09-27T00:39:19Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting/m-p/2814575#M85183</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;OK.  We'll use 'sed' to translate the ,*, strings to a pipe as already done.  At this point is appears that you want to make translations on field number 2, 6, and 9 if I understand correctly.&lt;BR /&gt;&lt;BR /&gt;Hence, pipe the output of the 'sed' to an 'awk' script.  Essentially, we will need to examine fields 2, 6, and 9 for anyone of the conditions you cited and substitute.&lt;BR /&gt;&lt;BR /&gt;Using one of the lines in your file:&lt;BR /&gt;&lt;BR /&gt;IIF     ,*,22I,*,2,*, ,*,OS,*,036R,*, ,*,  ,*,068G,*,   ,*,&lt;BR /&gt;&lt;BR /&gt;...THEN: sed -e 's/,\*,/|/g'&lt;BR /&gt;...produces:&lt;BR /&gt;&lt;BR /&gt;IIF     |22I|2| |OS|036R| |  |068G|   |&lt;BR /&gt;&lt;BR /&gt;...which we pipe to an 'awk' script, the beginnings of which might look like:&lt;BR /&gt;&lt;BR /&gt;awk -F\| 'BEGIN{OFS="|"}; $2~/..I/ {$2="xxx"};$6~/...R/ {$6="yyy"};{print $0}'&lt;BR /&gt;&lt;BR /&gt;...which with the above data would yield:&lt;BR /&gt;&lt;BR /&gt;IIF     |xxx|2| |OS|yyy| |  |068G|   |&lt;BR /&gt;&lt;BR /&gt;...I've used "xxx" and "yyy" for clarity of substitution.  For brevity, I didn't write a complete 'awk' script, only enough to show conceptually my suggestion.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 27 Sep 2002 01:45:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting/m-p/2814575#M85183</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2002-09-27T01:45:00Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting/m-p/2814576#M85184</link>
      <description>Man,&lt;BR /&gt;&lt;BR /&gt;How can I thankyou, If you were in Australia I would buy you a beer.&lt;BR /&gt;</description>
      <pubDate>Fri, 27 Sep 2002 03:54:29 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting/m-p/2814576#M85184</guid>
      <dc:creator>Arman Mahboobi</dc:creator>
      <dc:date>2002-09-27T03:54:29Z</dc:date>
    </item>
  </channel>
</rss>

