<?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/2477862#M728232</link>
    <description>Hi again,&lt;BR /&gt;&lt;BR /&gt;Here is the small abstract for agrep:&lt;BR /&gt;Searches text for strings or approximations thereof. Agrep is similar to the standard UNIX grep utility, but is more general, and according to its authors, usually faster. Its most notable feature is the approximate pattern matching facility. Agrep has other features not found in the grep family: It is record rather than line orientated; pattern matches can be output in a larger context than a single line. Multiple search patterns can be specified with AND/OR logic.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Dan&lt;BR /&gt;</description>
    <pubDate>Tue, 02 Jan 2001 15:12:50 GMT</pubDate>
    <dc:creator>Dan Hetzel</dc:creator>
    <dc:date>2001-01-02T15:12:50Z</dc:date>
    <item>
      <title>script help...</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/2477860#M728230</link>
      <description>Hi&lt;BR /&gt;&lt;BR /&gt;I want to parse a text file for a particular line - then when found read the &lt;BR /&gt;following lines until another line found&lt;BR /&gt;&lt;BR /&gt;ie&lt;BR /&gt;&lt;BR /&gt;find this line        PV Name  LE on PV  PE on PV&lt;BR /&gt;&lt;BR /&gt;push these to a new file      /dev/dsk/c2t4d0    2048      2048&lt;BR /&gt;&lt;BR /&gt;finsh here       --- Logical extents ---&lt;BR /&gt;&lt;BR /&gt;Hope someone can help&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;&lt;BR /&gt;Keith</description>
      <pubDate>Tue, 02 Jan 2001 15:05:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/2477860#M728230</guid>
      <dc:creator>Keith Floyd</dc:creator>
      <dc:date>2001-01-02T15:05:15Z</dc:date>
    </item>
    <item>
      <title>Re: script help...</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/2477861#M728231</link>
      <description>Hi Keith,&lt;BR /&gt;&lt;BR /&gt;AGREP is the best tool for you.&lt;BR /&gt;The main difference with grep, is that agrep has definabla record delimiters (could be a string) while grep only has the End-Of-line.&lt;BR /&gt;&lt;BR /&gt;You'll find it at the porting center:&lt;BR /&gt;&lt;A href="http://hpux.cae.wisc.edu/hppd/hpux/Misc/agrep-2.04/" target="_blank"&gt;http://hpux.cae.wisc.edu/hppd/hpux/Misc/agrep-2.04/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Best regards,&lt;BR /&gt;&lt;BR /&gt;Dan&lt;BR /&gt;</description>
      <pubDate>Tue, 02 Jan 2001 15:11:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/2477861#M728231</guid>
      <dc:creator>Dan Hetzel</dc:creator>
      <dc:date>2001-01-02T15:11:27Z</dc:date>
    </item>
    <item>
      <title>Re: script help...</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/2477862#M728232</link>
      <description>Hi again,&lt;BR /&gt;&lt;BR /&gt;Here is the small abstract for agrep:&lt;BR /&gt;Searches text for strings or approximations thereof. Agrep is similar to the standard UNIX grep utility, but is more general, and according to its authors, usually faster. Its most notable feature is the approximate pattern matching facility. Agrep has other features not found in the grep family: It is record rather than line orientated; pattern matches can be output in a larger context than a single line. Multiple search patterns can be specified with AND/OR logic.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Dan&lt;BR /&gt;</description>
      <pubDate>Tue, 02 Jan 2001 15:12:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/2477862#M728232</guid>
      <dc:creator>Dan Hetzel</dc:creator>
      <dc:date>2001-01-02T15:12:50Z</dc:date>
    </item>
    <item>
      <title>Re: script help...</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/2477863#M728233</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;looks like you want to get the devices for a log. volume.&lt;BR /&gt;Here my code:&lt;BR /&gt;lvdisplay -v /dev/vgXX/lvolX |awk 'BEGIN{f=0}&lt;BR /&gt;{&lt;BR /&gt;if($0 ~ "PV Name")&lt;BR /&gt;{&lt;BR /&gt;  f=1&lt;BR /&gt;  continue;&lt;BR /&gt;}&lt;BR /&gt;if($0 ~ "Logical extents")&lt;BR /&gt;{&lt;BR /&gt;  f=2;&lt;BR /&gt;  exit;&lt;BR /&gt;}&lt;BR /&gt;if(f==1)&lt;BR /&gt;{&lt;BR /&gt;  print $0&lt;BR /&gt;}&lt;BR /&gt;}'&lt;BR /&gt;&lt;BR /&gt;Regards</description>
      <pubDate>Tue, 02 Jan 2001 15:14:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/2477863#M728233</guid>
      <dc:creator>Andreas Voss</dc:creator>
      <dc:date>2001-01-02T15:14:45Z</dc:date>
    </item>
    <item>
      <title>Re: script help...</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/2477864#M728234</link>
      <description>cat your_file|&lt;BR /&gt;awk ' /PV Name/ {&lt;BR /&gt;getline;&lt;BR /&gt;while ( $0 !~ "Logical extends" ) {&lt;BR /&gt;print $0;&lt;BR /&gt;getline;&lt;BR /&gt;}&lt;BR /&gt;exit;&lt;BR /&gt;}'</description>
      <pubDate>Tue, 02 Jan 2001 15:25:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/2477864#M728234</guid>
      <dc:creator>Curtis Larson</dc:creator>
      <dc:date>2001-01-02T15:25:45Z</dc:date>
    </item>
    <item>
      <title>Re: script help...</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/2477865#M728235</link>
      <description>Are you trying to something like this: &lt;A href="http://my1.itrc.hp.com/cm/QuestionAnswer/1,1150,0x5cfe6c96588ad4118fef0090279cd0f9!0,00.html" target="_blank"&gt;http://my1.itrc.hp.com/cm/QuestionAnswer/1,1150,0x5cfe6c96588ad4118fef0090279cd0f9!0,00.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 02 Jan 2001 15:26:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/2477865#M728235</guid>
      <dc:creator>Carlos Fernandez Riera</dc:creator>
      <dc:date>2001-01-02T15:26:41Z</dc:date>
    </item>
    <item>
      <title>Re: script help...</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/2477866#M728236</link>
      <description>Try:&lt;BR /&gt;cat FILE | awk '/PV Name LE/,/Logical extents/' &amp;gt; NEW_FILE &lt;BR /&gt;</description>
      <pubDate>Tue, 02 Jan 2001 15:42:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/2477866#M728236</guid>
      <dc:creator>Tommy Palo</dc:creator>
      <dc:date>2001-01-02T15:42:31Z</dc:date>
    </item>
    <item>
      <title>Re: script help...</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/2477867#M728237</link>
      <description>and if you want something more generic put this into an executable file, such as print_from_s1_to_s2.&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/ksh&lt;BR /&gt;&lt;BR /&gt;string1=$1&lt;BR /&gt;string2=$2&lt;BR /&gt;&lt;BR /&gt;awk ' {&lt;BR /&gt;if ( $0 ~ "'"$string1"'" ) {&lt;BR /&gt;    getline;&lt;BR /&gt;    while ( $0 !~ "'"$string2"'" ) {&lt;BR /&gt;        # remove blanklines&lt;BR /&gt;        if ( $0 !~ /^$/ ) print $0;&lt;BR /&gt;        getline;&lt;BR /&gt;        }&lt;BR /&gt;     exit;&lt;BR /&gt;     }&lt;BR /&gt;}'&lt;BR /&gt;&lt;BR /&gt;then use it where ever you like&lt;BR /&gt;&lt;BR /&gt;lvdisplay | print_from_s1_to_s2 "PV Name" "Logical extents" &amp;gt; yourfile&lt;BR /&gt;</description>
      <pubDate>Tue, 02 Jan 2001 16:28:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/2477867#M728237</guid>
      <dc:creator>Curtis Larson</dc:creator>
      <dc:date>2001-01-02T16:28:45Z</dc:date>
    </item>
    <item>
      <title>Re: script help...</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/2477868#M728238</link>
      <description>Thanks &lt;BR /&gt;At least one works - I will check the various methods - and assign points - &lt;BR /&gt;&lt;BR /&gt;Again  thanks for all your help</description>
      <pubDate>Tue, 02 Jan 2001 17:17:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/2477868#M728238</guid>
      <dc:creator>Keith Floyd</dc:creator>
      <dc:date>2001-01-02T17:17:08Z</dc:date>
    </item>
    <item>
      <title>Re: script help...</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/2477869#M728239</link>
      <description>Keith:&lt;BR /&gt;&lt;BR /&gt;lvdisplay -v /dev/vg00/lvol1 | sed -n "/-- Distribution/,/^$/p"&lt;BR /&gt;&lt;BR /&gt;is close to what you want.&lt;BR /&gt;&lt;BR /&gt;This is a sed(1) "ranging".  The first /RE/ instructs sed(1) to find the line with the RE (where RE is a regular expression).  The second /RE/, /^$/ is looking for a blank line that follows the first RE.  'p' prints lines (that is why sed(1) was called with -n, don't print unless I tell you to).&lt;BR /&gt;&lt;BR /&gt;Now, using sed(1), lets strip out what you don't want:&lt;BR /&gt;&lt;BR /&gt;lvdisplay...| sed -n "/--Distribution/,/^$/{&lt;BR /&gt;/--Distribution/d&lt;BR /&gt;/PV Name/d&lt;BR /&gt;/^$/d&lt;BR /&gt;p&lt;BR /&gt;}"&lt;BR /&gt;&lt;BR /&gt;The stuff between the curly braces is a subroutine.  The statements delete what you don't want (including the trailing blank line) and explicity print what remains.&lt;BR /&gt;&lt;BR /&gt;Enjoy,&lt;BR /&gt;-dlt-</description>
      <pubDate>Thu, 04 Jan 2001 18:46:56 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/2477869#M728239</guid>
      <dc:creator>David Totsch</dc:creator>
      <dc:date>2001-01-04T18:46:56Z</dc:date>
    </item>
    <item>
      <title>Re: script help...</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/2477870#M728240</link>
      <description>I realized that you wanted to get rid of the target lines also so try:&lt;BR /&gt;&lt;BR /&gt;cat FILE | awk '/PV Name LE/,/Logical extents/' | sed -e '1d' -e '$d' &amp;gt; NEW_FILE &lt;BR /&gt;</description>
      <pubDate>Fri, 05 Jan 2001 07:40:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/2477870#M728240</guid>
      <dc:creator>Tommy Palo</dc:creator>
      <dc:date>2001-01-05T07:40:00Z</dc:date>
    </item>
  </channel>
</rss>

