<?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: Hail sed gurus in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/hail-sed-gurus/m-p/2656826#M928643</link>
    <description>Hi&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;If the file is not too long and each line starts with field try&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;echo $(cat outputfile)|sed -e 's/FIELD/\^JFIELD/g'&lt;BR /&gt;&lt;BR /&gt;^j is formed by cntrlVcntrlM&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;            Steve Steel</description>
    <pubDate>Fri, 01 Feb 2002 09:21:40 GMT</pubDate>
    <dc:creator>Steve Steel</dc:creator>
    <dc:date>2002-02-01T09:21:40Z</dc:date>
    <item>
      <title>Hail sed gurus</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/hail-sed-gurus/m-p/2656825#M928642</link>
      <description>I'm trying to write a script that takes the output of /opt/OV/bin/OpC/utils/opcdcode on &lt;BR /&gt;1. /var/opt/OV/conf/OpC/le&lt;BR /&gt;2. /var/opt/OV/conf/OpC/monitor&lt;BR /&gt;3. /var/opt/OV/conf/OpC/msgi&lt;BR /&gt;4. /var/opt/OV/conf/OpC/trapi&lt;BR /&gt;&lt;BR /&gt;(not necessarily required to know if you don't have ITO or variant apart from knowing output of this).&lt;BR /&gt;&lt;BR /&gt;Output produces multiple fields ($1) and field value "$2"&lt;BR /&gt;&lt;BR /&gt;Example Output:&lt;BR /&gt;&lt;BR /&gt;FIELD1 "value of some type"&lt;BR /&gt;        FIELD2 "whatever"&lt;BR /&gt;     FIELD3 "something else"&lt;BR /&gt;&lt;BR /&gt;(indents are varied but still conform to $1 $2)&lt;BR /&gt;&lt;BR /&gt;This output is particularly easy to work with. Unfotunately as per usual, some output from opcdcode is a little rogue in that for some particular fields, the "value" is found on the following line.&lt;BR /&gt;&lt;BR /&gt;Example Output:&lt;BR /&gt;&lt;BR /&gt;FIELD1 "value of some type"&lt;BR /&gt;        FIELD2 "whatever"&lt;BR /&gt;     FIELD3&lt;BR /&gt;        "something else"&lt;BR /&gt;&lt;BR /&gt;(indents are varied but still last line, the expected $2 becomes a $1)&lt;BR /&gt;&lt;BR /&gt;I know there is a simple sed solution.&lt;BR /&gt;I am looking for a sed (or sed/awk combo) that will join any line in which the first non space characted is a non letter (i.e. above the first character is "), with the line preceding.&lt;BR /&gt;&lt;BR /&gt;In effect making turning&lt;BR /&gt;&lt;BR /&gt;FIELD1 "X"&lt;BR /&gt;   FIELD2 "X"&lt;BR /&gt;  FIELD3&lt;BR /&gt;       "X"&lt;BR /&gt;   FIELD4 "X"&lt;BR /&gt;      FIELD5&lt;BR /&gt;  "X"&lt;BR /&gt;&lt;BR /&gt;into&lt;BR /&gt;&lt;BR /&gt;FIELD1 "X"&lt;BR /&gt;   FIELD2 "X"&lt;BR /&gt;  FIELD3 "X"&lt;BR /&gt;   FIELD4 "X"&lt;BR /&gt;      FIELD5 "X"&lt;BR /&gt;&lt;BR /&gt;Any help much appreciated and rewarded&lt;BR /&gt;&lt;BR /&gt;Glenn</description>
      <pubDate>Fri, 01 Feb 2002 05:16:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/hail-sed-gurus/m-p/2656825#M928642</guid>
      <dc:creator>Glenn L. Stewart</dc:creator>
      <dc:date>2002-02-01T05:16:19Z</dc:date>
    </item>
    <item>
      <title>Re: Hail sed gurus</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/hail-sed-gurus/m-p/2656826#M928643</link>
      <description>Hi&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;If the file is not too long and each line starts with field try&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;echo $(cat outputfile)|sed -e 's/FIELD/\^JFIELD/g'&lt;BR /&gt;&lt;BR /&gt;^j is formed by cntrlVcntrlM&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;            Steve Steel</description>
      <pubDate>Fri, 01 Feb 2002 09:21:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/hail-sed-gurus/m-p/2656826#M928643</guid>
      <dc:creator>Steve Steel</dc:creator>
      <dc:date>2002-02-01T09:21:40Z</dc:date>
    </item>
    <item>
      <title>Re: Hail sed gurus</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/hail-sed-gurus/m-p/2656827#M928644</link>
      <description>I swear there must be an easier way to do this in awk, but this is all I could come up with:&lt;BR /&gt;&lt;BR /&gt;awk 'BEGIN {RS="";a=1;b=2}      {while (a &amp;lt; NF)      {print $'a'" "$'b';a+=1;b+=1}      }' inputfile&lt;BR /&gt;&lt;BR /&gt;Grtz.&lt;BR /&gt;&lt;BR /&gt;Vincent</description>
      <pubDate>Fri, 01 Feb 2002 09:56:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/hail-sed-gurus/m-p/2656827#M928644</guid>
      <dc:creator>Vincent Stedema</dc:creator>
      <dc:date>2002-02-01T09:56:15Z</dc:date>
    </item>
    <item>
      <title>Re: Hail sed gurus</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/hail-sed-gurus/m-p/2656828#M928645</link>
      <description>Hi Glenn,&lt;BR /&gt;&lt;BR /&gt;Create an awk script containing:&lt;BR /&gt;&lt;BR /&gt;BEGIN{FS=""}&lt;BR /&gt;$1 !~ "[a-zA-Z]"{printf(" %s",$0);next}&lt;BR /&gt;{printf("%s%s"),s,$0;s="\n"}&lt;BR /&gt;END{print}&lt;BR /&gt;&lt;BR /&gt;then run with &lt;BR /&gt;&lt;BR /&gt;awk -f scriptname filename&lt;BR /&gt;&lt;BR /&gt;Rgds, Robin.&lt;BR /&gt;</description>
      <pubDate>Fri, 01 Feb 2002 10:22:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/hail-sed-gurus/m-p/2656828#M928645</guid>
      <dc:creator>Robin Wakefield</dc:creator>
      <dc:date>2002-02-01T10:22:46Z</dc:date>
    </item>
    <item>
      <title>Re: Hail sed gurus</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/hail-sed-gurus/m-p/2656829#M928646</link>
      <description>The question is number of fields in each line?&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;awk ' NF == 2 { print $1 .... ; next}&lt;BR /&gt;NF == 1 { last=$0; getline; print last, $0 }'&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;### NF -&amp;gt; number of fields</description>
      <pubDate>Fri, 01 Feb 2002 11:16:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/hail-sed-gurus/m-p/2656829#M928646</guid>
      <dc:creator>Carlos Fernandez Riera</dc:creator>
      <dc:date>2002-02-01T11:16:15Z</dc:date>
    </item>
    <item>
      <title>Re: Hail sed gurus</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/hail-sed-gurus/m-p/2656830#M928647</link>
      <description>This webpage doesn't do my example justice. It aligns everything to the left, where the actual example isn't formatted that way.&lt;BR /&gt;&lt;BR /&gt;I've attached the four text files in question.&lt;BR /&gt;&lt;BR /&gt;Namely:&lt;BR /&gt;le, monitor, msgi and trapi (not as important)&lt;BR /&gt;&lt;BR /&gt;The monitor file seems okay; all fields are short enough to remain on the same line.&lt;BR /&gt;That doesn't mean that in the future this file will always remain this way.&lt;BR /&gt;&lt;BR /&gt;So, running the following command on the other three files, will highlight the entries not conforming to my script - hence requiring a sed/awk fix.&lt;BR /&gt;&lt;BR /&gt;# cat le | awk '{print $1}' | grep -v ^[A-Z] | sort | uniq&lt;BR /&gt;&lt;BR /&gt;Attaching the input, will help you all in providing me a suitable solution.&lt;BR /&gt;I will certainly reward 10 points for each and every solution, even if it is solved by a previous user. It's the least I can do for any help provided.&lt;BR /&gt;The smaller the solution, the better.&lt;BR /&gt;&lt;BR /&gt;Explaining my logic in using the command above:&lt;BR /&gt;The file has varying tabs before $1. Therefore the awk portion eliminates this. The Fields (always starting with A-Z), are then removed by the grep, leaving values that should be joined with the previous line.&lt;BR /&gt;&lt;BR /&gt;For example, in file msgi, the first occurance of "20m":&lt;BR /&gt;&lt;BR /&gt;As per file (indents exist before each line but are taken out by this website).&lt;BR /&gt;&lt;BR /&gt;SUPP_DUPL_IDENT&lt;BR /&gt;"20m" RESEND "1d"&lt;BR /&gt;&lt;BR /&gt;Should instead read&lt;BR /&gt;&lt;BR /&gt;SUPP_DUPL_IDENT "20m"&lt;BR /&gt;RESEND "1d"&lt;BR /&gt;&lt;BR /&gt;In format&lt;BR /&gt;FIELD "Value value value"&lt;BR /&gt;&lt;BR /&gt;Please note, that not all incorrect values start with "&lt;BR /&gt;&lt;BR /&gt;The file trapi is a good example.&lt;BR /&gt;&lt;BR /&gt;CONDITION&lt;BR /&gt;$e ".1.3.6.1.4.1.11.2.17.1"&lt;BR /&gt;$G 6&lt;BR /&gt;$S 58916865&lt;BR /&gt;&lt;BR /&gt;trapi is certainly a harder one to tackle, and might need a varied solution because of format:&lt;BR /&gt;&lt;BR /&gt;FIELD1&lt;BR /&gt;SUB_FIELD1 "Value"&lt;BR /&gt;SUB_FIELD2 "Value"&lt;BR /&gt;&lt;BR /&gt;I might write something to output this in format.&lt;BR /&gt;&lt;BR /&gt;FIELD1 SUB_FIELD1 "Value"&lt;BR /&gt;FIELD1 SUB FILED2 "Value"&lt;BR /&gt;&lt;BR /&gt;Anyway....&lt;BR /&gt;Any help mainly on the " values being on the wrong line in le and msgi would be most helpful&lt;BR /&gt;&lt;BR /&gt;Thanks heaps in advance&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 04 Feb 2002 06:43:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/hail-sed-gurus/m-p/2656830#M928647</guid>
      <dc:creator>Glenn L. Stewart</dc:creator>
      <dc:date>2002-02-04T06:43:27Z</dc:date>
    </item>
    <item>
      <title>Re: Hail sed gurus</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/hail-sed-gurus/m-p/2656831#M928648</link>
      <description>Hi Glenn,&lt;BR /&gt;&lt;BR /&gt;Can you please check the attachment, I can't get to it.&lt;BR /&gt;&lt;BR /&gt;Rgds, Robin</description>
      <pubDate>Mon, 04 Feb 2002 08:04:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/hail-sed-gurus/m-p/2656831#M928648</guid>
      <dc:creator>Robin Wakefield</dc:creator>
      <dc:date>2002-02-04T08:04:08Z</dc:date>
    </item>
    <item>
      <title>Re: Hail sed gurus</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/hail-sed-gurus/m-p/2656832#M928649</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;Having trouble getting to the attachment myself.&lt;BR /&gt;I'll re-attach it when I get back to work tomorrow morning (currently late Monday afternoon in Sydney)</description>
      <pubDate>Mon, 04 Feb 2002 08:21:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/hail-sed-gurus/m-p/2656832#M928649</guid>
      <dc:creator>Glenn L. Stewart</dc:creator>
      <dc:date>2002-02-04T08:21:42Z</dc:date>
    </item>
    <item>
      <title>Re: Hail sed gurus</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/hail-sed-gurus/m-p/2656833#M928650</link>
      <description>Hi Glenn,&lt;BR /&gt;&lt;BR /&gt;Off topic - my son's there at the moment, he's just mailed me to say it's raining harder than he's ever seen before!! - hope you're not getting flooded...Robin</description>
      <pubDate>Mon, 04 Feb 2002 09:19:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/hail-sed-gurus/m-p/2656833#M928650</guid>
      <dc:creator>Robin Wakefield</dc:creator>
      <dc:date>2002-02-04T09:19:59Z</dc:date>
    </item>
    <item>
      <title>Re: Hail sed gurus</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/hail-sed-gurus/m-p/2656834#M928651</link>
      <description>Robin, you're right. The rain is bucketing down. High on the scale of crappy weather, but nothing compared to some storms I've seen - a la April 1999 hail storm. Well over 1 billion worth of damage of a few small suburbs.&lt;BR /&gt;What's your son doing in Sydney?&lt;BR /&gt;&lt;BR /&gt;Anyway...&lt;BR /&gt;I've attached the file again.&lt;BR /&gt;&lt;BR /&gt;Thanks</description>
      <pubDate>Mon, 04 Feb 2002 22:30:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/hail-sed-gurus/m-p/2656834#M928651</guid>
      <dc:creator>Glenn L. Stewart</dc:creator>
      <dc:date>2002-02-04T22:30:10Z</dc:date>
    </item>
    <item>
      <title>Re: Hail sed gurus</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/hail-sed-gurus/m-p/2656835#M928652</link>
      <description>Once again the attachement doesn't work...&lt;BR /&gt;I can't understand why. Take 3.</description>
      <pubDate>Mon, 04 Feb 2002 22:31:34 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/hail-sed-gurus/m-p/2656835#M928652</guid>
      <dc:creator>Glenn L. Stewart</dc:creator>
      <dc:date>2002-02-04T22:31:34Z</dc:date>
    </item>
    <item>
      <title>Re: Hail sed gurus</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/hail-sed-gurus/m-p/2656836#M928653</link>
      <description>Okay... the attachments aren't working for me.&lt;BR /&gt;I'll put in a call through the response centre. We're always concerned about the response time from Australia of itrc. At least this is something else along the performance line that I can at least inform the itrc folks about.&lt;BR /&gt;&lt;BR /&gt;If you wish, I can email the file to whomever wants to attempt this tricky problem.&lt;BR /&gt;&lt;BR /&gt;Feel free to email mail - glenn@inodes.net&lt;BR /&gt;&lt;BR /&gt;Thanks</description>
      <pubDate>Mon, 04 Feb 2002 22:35:33 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/hail-sed-gurus/m-p/2656836#M928653</guid>
      <dc:creator>Glenn L. Stewart</dc:creator>
      <dc:date>2002-02-04T22:35:33Z</dc:date>
    </item>
  </channel>
</rss>

