<?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 in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/script/m-p/2814154#M85071</link>
    <description>Hi,&lt;BR /&gt;  Thanks to all for the help. &lt;BR /&gt;&lt;BR /&gt;Thank you Jean-Luc your  solution worked perfect. &lt;BR /&gt;&lt;BR /&gt;Rgds,&lt;BR /&gt;Dinesh.</description>
    <pubDate>Thu, 26 Sep 2002 15:10:47 GMT</pubDate>
    <dc:creator>hpuxsa</dc:creator>
    <dc:date>2002-09-26T15:10:47Z</dc:date>
    <item>
      <title>Script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script/m-p/2814145#M85062</link>
      <description>Hi,&lt;BR /&gt; I have a text file which has a BEGIN and END for each entry in it. I am trying to extract a field (enclosed in +++) from each entry and for that corresponding entry i am trying to extract another two lines (enclosed in ---) and pass it to another command. Could someone please tell me how I can do this. (Note: the +++ and --- do not exist in the original file it is only for identifying the field)&lt;BR /&gt; &lt;BR /&gt;Rgds,&lt;BR /&gt;Gen&lt;BR /&gt;Please find the text file below.&lt;BR /&gt;&lt;BR /&gt;???BEGIN     +++ 702076283 +++???&lt;BR /&gt;???         AA=123A,VV=PQR7,SS=CAT067B                                                         ???&lt;BR /&gt;???       --- ALARM 299 O1/SW_DEV "CBC71C0021A07E0"A 020925 1115???&lt;BR /&gt;???DIGITAL PATH QUALITY SUPERVISION---???&lt;BR /&gt;???BES???&lt;BR /&gt;???WIP      WIPPART  SESL2  QSV    SECTION  DATE    TIME???&lt;BR /&gt;???RBLT18            1      2               020925  111500???&lt;BR /&gt;???END                                                 ???&lt;BR /&gt;&lt;BR /&gt;???BEGIN      +++702086280 +++???&lt;BR /&gt;???         NW=TSS,NE=TRS7,EQ=TAX067A                                        ???&lt;BR /&gt;???       --- ALARM 297 A2/SW_DEV "BSC71C0021A07E0"A 020925 0741???&lt;BR /&gt;???RADIO X-CEIVER ADMINISTRATION---???&lt;BR /&gt;???MANAGED OBJECT FAULT???&lt;BR /&gt;???MO                                 RSITE           ALARM SLOGAN???&lt;BR /&gt;???RXOTS-6-0-5                        TAX067A         TS SYNC FAULT???&lt;BR /&gt;???END???&lt;BR /&gt;</description>
      <pubDate>Thu, 26 Sep 2002 13:43:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script/m-p/2814145#M85062</guid>
      <dc:creator>hpuxsa</dc:creator>
      <dc:date>2002-09-26T13:43:12Z</dc:date>
    </item>
    <item>
      <title>Re: Script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script/m-p/2814146#M85063</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;Crudely:&lt;BR /&gt;&lt;BR /&gt;# awk '/BEGIN/,/END/ {print $0}' filein | awk '/---/,/---/ {print $0}'&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Thu, 26 Sep 2002 13:50:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script/m-p/2814146#M85063</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2002-09-26T13:50:27Z</dc:date>
    </item>
    <item>
      <title>Re: Script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script/m-p/2814147#M85064</link>
      <description>If "---" is not part of the data, how do you identify the 2 lines you want.&lt;BR /&gt;&lt;BR /&gt;Here is an awk script to search for BEGIN and save the number following it. It then looks for ALARM and prints the saved number and the line.&lt;BR /&gt;&lt;BR /&gt;awk -e '/^BEGIN/{sav=$2};/^ALARM/{print sav,$0}' yourfile&lt;BR /&gt;&lt;BR /&gt;hope this helps...&lt;BR /&gt;&lt;BR /&gt;-- Rod Hills&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 26 Sep 2002 14:02:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script/m-p/2814147#M85064</guid>
      <dc:creator>Rodney Hills</dc:creator>
      <dc:date>2002-09-26T14:02:38Z</dc:date>
    </item>
    <item>
      <title>Re: Script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script/m-p/2814148#M85065</link>
      <description>Hi James,&lt;BR /&gt;&lt;BR /&gt;I could manage to get the first field the one enclosed in +++. But I am having trouble with the second one (the text enclosed in ---) because it is more than one line. The real file does not have +++ and --- on it.&lt;BR /&gt;&lt;BR /&gt;Thank you for the help.&lt;BR /&gt;</description>
      <pubDate>Thu, 26 Sep 2002 14:05:55 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script/m-p/2814148#M85065</guid>
      <dc:creator>hpuxsa</dc:creator>
      <dc:date>2002-09-26T14:05:55Z</dc:date>
    </item>
    <item>
      <title>Re: Script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script/m-p/2814149#M85066</link>
      <description>how about this nastiness in vi&lt;BR /&gt;&lt;BR /&gt;:1&lt;BR /&gt;/^BEGIN&lt;BR /&gt;f (that's an f, then a space ( ) VERY IMPORTANT)&lt;BR /&gt;:1&lt;BR /&gt;:map x /ctrlVctrlM;li+++ctrlV&lt;ESC&gt;$a+++ctrlV&lt;ESC&gt;jj^i---ctrlV&lt;ESC&gt;j$a---ctrlV&lt;ESC&gt;kJ&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;then type in x for every "block"&lt;BR /&gt;&lt;BR /&gt;note: ctrlV&lt;ESC&gt; is a control v and then an escape&lt;BR /&gt;&lt;BR /&gt;live free or die&lt;BR /&gt;harry&lt;/ESC&gt;&lt;/ESC&gt;&lt;/ESC&gt;&lt;/ESC&gt;&lt;/ESC&gt;</description>
      <pubDate>Thu, 26 Sep 2002 14:26:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script/m-p/2814149#M85066</guid>
      <dc:creator>harry d brown jr</dc:creator>
      <dc:date>2002-09-26T14:26:46Z</dc:date>
    </item>
    <item>
      <title>Re: Script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script/m-p/2814150#M85067</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;As Rod says, it's not clear how to identify the lines you're after.  If we assume they're always two lines long, you want them joined together, and they're  always the 2nd/3rd lines after the BEGIN line, then:&lt;BR /&gt;&lt;BR /&gt;awk '/BEGIN/{getline;getline;s=$0;getline;print s$0}' file&lt;BR /&gt;&lt;BR /&gt;would be one way of doing it.&lt;BR /&gt;&lt;BR /&gt;Rgds, Robin.</description>
      <pubDate>Thu, 26 Sep 2002 14:28:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script/m-p/2814150#M85067</guid>
      <dc:creator>Robin Wakefield</dc:creator>
      <dc:date>2002-09-26T14:28:23Z</dc:date>
    </item>
    <item>
      <title>Re: Script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script/m-p/2814151#M85068</link>
      <description>I assumed you have a space between +++ or --- and next field.&lt;BR /&gt;&lt;BR /&gt;awk '&lt;BR /&gt;{&lt;BR /&gt;if($1=="BEGIN") item1=$3;&lt;BR /&gt;if($1=="---") {&lt;BR /&gt;        item2=substr($0,5);&lt;BR /&gt;        getline;&lt;BR /&gt;        item3=$0;&lt;BR /&gt;        gsub("-","",item3);&lt;BR /&gt;}&lt;BR /&gt;if($1=="END") print item1,item2,item3;&lt;BR /&gt;}' filein&lt;BR /&gt;&lt;BR /&gt;result :&lt;BR /&gt;702076283  ALARM 299 O1/SW_DEV "CBC71C0021A07E0"A 020925 1115  DIGITAL PATH QUAL&lt;BR /&gt;ITY SUPERVISION &lt;BR /&gt;702086280  ALARM 297 A2/SW_DEV "BSC71C0021A07E0"A 020925 0741  RADIO XCEIVER ADM&lt;BR /&gt;INISTRATION &lt;BR /&gt;&lt;BR /&gt;Jean-Luc</description>
      <pubDate>Thu, 26 Sep 2002 14:31:55 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script/m-p/2814151#M85068</guid>
      <dc:creator>Jean-Luc Oudart</dc:creator>
      <dc:date>2002-09-26T14:31:55Z</dc:date>
    </item>
    <item>
      <title>Re: Script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script/m-p/2814152#M85069</link>
      <description>Your file formatting really got hosed when it was included in the message. Could you include the data file as an attachment?&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 26 Sep 2002 14:40:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script/m-p/2814152#M85069</guid>
      <dc:creator>Tom Maloy</dc:creator>
      <dc:date>2002-09-26T14:40:15Z</dc:date>
    </item>
    <item>
      <title>Re: Script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script/m-p/2814153#M85070</link>
      <description>As I didn't understand the criteria for the lines that you are looking for, the following simple script may help you if you modify it to your needs.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;DATA=data&lt;BR /&gt;ENTRIES=`cat $DATA |grep "^BEGIN" |awk '{print $2}'`&lt;BR /&gt;&lt;BR /&gt;for ENTRY in $ENTRIES&lt;BR /&gt;do&lt;BR /&gt;echo "ENTRY: $ENTRY"&lt;BR /&gt;sed '1,/'$ENTRY'/d' $DATA |head -3|tail -2&lt;BR /&gt;done &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;-Sri</description>
      <pubDate>Thu, 26 Sep 2002 14:44:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script/m-p/2814153#M85070</guid>
      <dc:creator>Sridhar Bhaskarla</dc:creator>
      <dc:date>2002-09-26T14:44:16Z</dc:date>
    </item>
    <item>
      <title>Re: Script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script/m-p/2814154#M85071</link>
      <description>Hi,&lt;BR /&gt;  Thanks to all for the help. &lt;BR /&gt;&lt;BR /&gt;Thank you Jean-Luc your  solution worked perfect. &lt;BR /&gt;&lt;BR /&gt;Rgds,&lt;BR /&gt;Dinesh.</description>
      <pubDate>Thu, 26 Sep 2002 15:10:47 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script/m-p/2814154#M85071</guid>
      <dc:creator>hpuxsa</dc:creator>
      <dc:date>2002-09-26T15:10:47Z</dc:date>
    </item>
  </channel>
</rss>

