<?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: script help in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/2646390#M879397</link>
    <description>Sorry, that is the -V option (not -F).&lt;BR /&gt;&lt;BR /&gt;-- Rod Hills</description>
    <pubDate>Wed, 16 Jan 2002 20:50:36 GMT</pubDate>
    <dc:creator>Rodney Hills</dc:creator>
    <dc:date>2002-01-16T20:50:36Z</dc:date>
    <item>
      <title>script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/2646383#M879390</link>
      <description>Hello everyone,&lt;BR /&gt;&lt;BR /&gt;I have a report that have 10 different kinds of data (i.e: data: CMTP&lt;BR /&gt;info about the data ....&lt;BR /&gt;....&lt;BR /&gt;....&lt;BR /&gt;&lt;BR /&gt;data: MDCA&lt;BR /&gt;info about the data....&lt;BR /&gt;....&lt;BR /&gt;....)&lt;BR /&gt;and each data has various info that some can be 1 page or up to 3 pages long.  So instead of have over 100 pages of report to see only 2 of the data info that is require - I'm writing a script to parse the info for the 2 types of data that are needed and send it to another file so that the user can print it if he/she wants.  I had tried grep (but it only show the line where it matches not the info after that) I'd read that sed can do the trick.  Can someone help me with this.  Thank you.&lt;BR /&gt;&lt;BR /&gt;Thi</description>
      <pubDate>Wed, 16 Jan 2002 15:55:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/2646383#M879390</guid>
      <dc:creator>Thi Vu</dc:creator>
      <dc:date>2002-01-16T15:55:03Z</dc:date>
    </item>
    <item>
      <title>Re: script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/2646384#M879391</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;You can do something like this:&lt;BR /&gt;num=`grep -n "CMDAS" coco1| cut -d":" -f1`&lt;BR /&gt;echo $num&lt;BR /&gt;echo "$num,\$ w temp" |ed coco1&lt;BR /&gt;num2=`grep -n "DATA" temp| head -2 | tail -1 | cut -d":" -f1`&lt;BR /&gt;echo $num2&lt;BR /&gt;(( num2 = num2 -1 ))&lt;BR /&gt;echo "1,$num2 w temp" |ed temp&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;&lt;BR /&gt;Justo.</description>
      <pubDate>Wed, 16 Jan 2002 16:24:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/2646384#M879391</guid>
      <dc:creator>Justo Exposito</dc:creator>
      <dc:date>2002-01-16T16:24:38Z</dc:date>
    </item>
    <item>
      <title>Re: script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/2646385#M879392</link>
      <description>It depends a lot on what defines the start of the info and the end. If it is like you show, then the following will fetch that block of info.&lt;BR /&gt;&lt;BR /&gt;  sed -n -e '/^data: /,/.*)$/p' &lt;ORIGFILE&gt;newfile&lt;BR /&gt;&lt;BR /&gt;-- Rod Hills&lt;/ORIGFILE&gt;</description>
      <pubDate>Wed, 16 Jan 2002 16:45:33 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/2646385#M879392</guid>
      <dc:creator>Rodney Hills</dc:creator>
      <dc:date>2002-01-16T16:45:33Z</dc:date>
    </item>
    <item>
      <title>Re: script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/2646386#M879393</link>
      <description>you can also use awk to rip between two patterns:&lt;BR /&gt;&lt;BR /&gt;awk '/data: DATA/,/end/ { print $0 }' file.dat</description>
      <pubDate>Wed, 16 Jan 2002 17:01:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/2646386#M879393</guid>
      <dc:creator>David Lodge</dc:creator>
      <dc:date>2002-01-16T17:01:54Z</dc:date>
    </item>
    <item>
      <title>Re: script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/2646387#M879394</link>
      <description>#!/usr/bin/perl -d&lt;BR /&gt;#&lt;BR /&gt;   $ReportFile = "/tmp/4";&lt;BR /&gt;#&lt;BR /&gt;   open(REPORTLINES, "&amp;lt;".$ReportFile) || die "can not open $ReportFile";&lt;BR /&gt;#&lt;BR /&gt;LINE: while(&lt;REPORTLINES&gt;){&lt;BR /&gt;   $lineofdata = $_;&lt;BR /&gt;   if (substr($lineofdata,0,5) eq "Data:") { &lt;BR /&gt;      $reportname = substr($lineofdata,6,length($lineofdata)-6);&lt;BR /&gt;      $ReportFileName=$ReportFile . $reportname;&lt;BR /&gt;      close(NEWREPORT);&lt;BR /&gt;      open(NEWREPORT, "&amp;gt;".$ReportFileName) || die "can not open $ReportFile$repo&lt;BR /&gt;rtname";&lt;BR /&gt;      next LINE;&lt;BR /&gt;   }&lt;BR /&gt;#&lt;BR /&gt;   printf NEWREPORT $lineofdata;&lt;BR /&gt;   }&lt;BR /&gt;   close(REPORTFIXED);&lt;/REPORTLINES&gt;</description>
      <pubDate>Wed, 16 Jan 2002 17:39:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/2646387#M879394</guid>
      <dc:creator>harry d brown jr</dc:creator>
      <dc:date>2002-01-16T17:39:53Z</dc:date>
    </item>
    <item>
      <title>Re: script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/2646388#M879395</link>
      <description>Thank you for all your help.  I can only use one suggestion and need more help, this is what my script look like:&lt;BR /&gt;&lt;BR /&gt;list="CTMT GRPP MDDA"&lt;BR /&gt;&lt;BR /&gt;for file in $list&lt;BR /&gt;do&lt;BR /&gt;   awk '/DATA: $file/,/Report/ {print $0}' &lt;ORIGFILE&gt; &amp;gt;&amp;gt;&lt;NEWFILE&gt;&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;This will allow me to go through loop and print 3 types of data and append it to a newfile.  However, when I ran this sript the variable $file did not get pass to the awk command line at all.  The error report from awk is:&lt;BR /&gt;&lt;BR /&gt;awk: There is a regular expression error.&lt;BR /&gt;        Invalid pattern.&lt;BR /&gt; The input line number is 1.&lt;BR /&gt; The source line number is 1.&lt;BR /&gt;&lt;BR /&gt;Is there a way to pass a variable to the awk command in a script ?  Again thank you for your help.&lt;BR /&gt;&lt;BR /&gt;Thi&lt;/NEWFILE&gt;&lt;/ORIGFILE&gt;</description>
      <pubDate>Wed, 16 Jan 2002 20:34:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/2646388#M879395</guid>
      <dc:creator>Thi Vu</dc:creator>
      <dc:date>2002-01-16T20:34:39Z</dc:date>
    </item>
    <item>
      <title>Re: script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/2646389#M879396</link>
      <description>Passing args to an awk script requires using the -F option, Change your-&lt;BR /&gt;awk '/DATA: $file/,/Report/ {print $0}' &lt;ORIGFILE&gt; &amp;gt;&amp;gt;&lt;NEWFILE&gt; &lt;BR /&gt;&lt;BR /&gt;to&lt;BR /&gt;&lt;BR /&gt;awk -Ffile="DATA: $file" 'file,/Report/ {print $0}' ...&lt;BR /&gt;&lt;BR /&gt;The -F option sets awk variable "file" to "DATA: $file" and then you can use that awk variable in your awk script.&lt;BR /&gt;&lt;BR /&gt;-- Rod Hills&lt;/NEWFILE&gt;&lt;/ORIGFILE&gt;</description>
      <pubDate>Wed, 16 Jan 2002 20:49:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/2646389#M879396</guid>
      <dc:creator>Rodney Hills</dc:creator>
      <dc:date>2002-01-16T20:49:41Z</dc:date>
    </item>
    <item>
      <title>Re: script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/2646390#M879397</link>
      <description>Sorry, that is the -V option (not -F).&lt;BR /&gt;&lt;BR /&gt;-- Rod Hills</description>
      <pubDate>Wed, 16 Jan 2002 20:50:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/2646390#M879397</guid>
      <dc:creator>Rodney Hills</dc:creator>
      <dc:date>2002-01-16T20:50:36Z</dc:date>
    </item>
    <item>
      <title>Re: script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/2646391#M879398</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;Try this:&lt;BR /&gt;&lt;BR /&gt;# file=/tmp/myfile&lt;BR /&gt;# echo awk '$0~DATA: file,/Report/ {print $0}' file=$file &lt;ORIGFILE&gt; &amp;gt;&amp;gt; &lt;NEWFILE&gt;&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;/NEWFILE&gt;&lt;/ORIGFILE&gt;</description>
      <pubDate>Wed, 16 Jan 2002 21:08:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/2646391#M879398</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2002-01-16T21:08:54Z</dc:date>
    </item>
  </channel>
</rss>

