<?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: sed command help!!! in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/sed-command-help/m-p/3219053#M169976</link>
    <description>Hi,&lt;BR /&gt;&lt;BR /&gt;This uses awk rather than sed, but gets the result you wanted.&lt;BR /&gt;&lt;BR /&gt;I've created 2 files. The input file is test.in and contains the following :-&lt;BR /&gt;&lt;BR /&gt;DATE: MAR 03 2004 CLASS: UX_PROD TAPES: 030043 030260 030233 030237 FILES:&lt;BR /&gt;/oracle* /oracle1* /oracle2*&lt;BR /&gt;&lt;BR /&gt;DATE: MAR 04 2004 CLASS: UX_PROD_OTHER TAPES: 030127 FILES: /sybdump&lt;BR /&gt;&lt;BR /&gt;test.ksh contains :-&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;cat ./test.in | awk -F" " ' \&lt;BR /&gt; BEGIN {}&lt;BR /&gt; /UX_PROD TAPES/ {print $1" "$2" "$3" "$4" "$5" "$6" "$7" &lt;BR /&gt;"$8" &lt;BR /&gt;"$9"&lt;BR /&gt;&lt;BR /&gt;"$10" &lt;BR /&gt;"$11" "$12" "$13" "$14" "$15}&lt;BR /&gt; /UX_PROD_OTHER TAPES/ {print $1" "$2" "$3" "$4" "$5" "$6" "$7" &lt;BR /&gt;"$8" "$9"&lt;BR /&gt;"$10" "$11" "$12" "$13" "$14" "$15}'&lt;BR /&gt;&lt;BR /&gt;Run ksh ./test.ksh and the output is as you wanted :-&lt;BR /&gt;&lt;BR /&gt;DATE: MAR 03 2004 CLASS: UX_PROD TAPES: &lt;BR /&gt;030043 &lt;BR /&gt;030260 &lt;BR /&gt;030233 &lt;BR /&gt;030237 FILES: /oracle* /oracle1* /oracle2*&lt;BR /&gt;DATE: MAR 04 2004 CLASS: UX_PROD_OTHER TAPES: &lt;BR /&gt;030127 FILES: /sybdump&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;&lt;BR /&gt;Dave.</description>
    <pubDate>Mon, 15 Mar 2004 12:26:12 GMT</pubDate>
    <dc:creator>David Burgess</dc:creator>
    <dc:date>2004-03-15T12:26:12Z</dc:date>
    <item>
      <title>sed command help!!!</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sed-command-help/m-p/3219051#M169974</link>
      <description>I am trying to perform an action and a subset of data in a line.  I got it add what I wanted but it also added it before the day in the date. &lt;BR /&gt;&lt;BR /&gt;Why does this command work?&lt;BR /&gt;&lt;BR /&gt;sed 's/\(TAPES\:.*\) \(FILES\:.*\)/{s/ 0/&lt;BR /&gt;0//}g'&lt;BR /&gt;&lt;BR /&gt;Data Before:&lt;BR /&gt;DATE: MAR 03 2004 CLASS: UX_PROD TAPES: 030043 030260 030233 030237  FILES: /oracle* /oracle1* /oracle2* &lt;BR /&gt;&lt;BR /&gt;DATE: MAR 04 2004 CLASS: UX_PROD_OTHER TAPES: 030127  FILES: /sybdump&lt;BR /&gt;&lt;BR /&gt;What I am trying to do DATA AFTER:&lt;BR /&gt;&lt;BR /&gt;DATE: MAR 03 2004 CLASS: UX_PROD TAPES: &lt;BR /&gt;030043 &lt;BR /&gt;030260 &lt;BR /&gt;030233 &lt;BR /&gt;030237  FILES: /oracle* /oracle1* /oracle2* &lt;BR /&gt;&lt;BR /&gt;DATE: MAR 04 2004 CLASS: UX_PROD_OTHER TAPES: &lt;BR /&gt;030127  FILES: /sybdump&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 15 Mar 2004 11:35:57 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sed-command-help/m-p/3219051#M169974</guid>
      <dc:creator>Cesar Fernandes</dc:creator>
      <dc:date>2004-03-15T11:35:57Z</dc:date>
    </item>
    <item>
      <title>Re: sed command help!!!</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sed-command-help/m-p/3219052#M169975</link>
      <description>Can we try awk ?&lt;BR /&gt;&lt;BR /&gt;#!/bin/sh&lt;BR /&gt;&lt;BR /&gt;awk '&lt;BR /&gt;{&lt;BR /&gt; flg=0;&lt;BR /&gt; n1=split($0,tab);&lt;BR /&gt; for(i=1; i &amp;lt;= n1;i++) {&lt;BR /&gt;        if(tab[i]=="FILES:") flg=0;&lt;BR /&gt;        if(flg==1) printf("&lt;BR /&gt;");&lt;BR /&gt;        printf("%s ",tab[i]);&lt;BR /&gt;        if(tab[i]=="TAPES:") flg=1;&lt;BR /&gt; }&lt;BR /&gt; printf("\n");&lt;BR /&gt;}' &lt;YOUR input="" file=""&gt;&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Jean-Luc&lt;/YOUR&gt;</description>
      <pubDate>Mon, 15 Mar 2004 12:20:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sed-command-help/m-p/3219052#M169975</guid>
      <dc:creator>Jean-Luc Oudart</dc:creator>
      <dc:date>2004-03-15T12:20:26Z</dc:date>
    </item>
    <item>
      <title>Re: sed command help!!!</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sed-command-help/m-p/3219053#M169976</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;This uses awk rather than sed, but gets the result you wanted.&lt;BR /&gt;&lt;BR /&gt;I've created 2 files. The input file is test.in and contains the following :-&lt;BR /&gt;&lt;BR /&gt;DATE: MAR 03 2004 CLASS: UX_PROD TAPES: 030043 030260 030233 030237 FILES:&lt;BR /&gt;/oracle* /oracle1* /oracle2*&lt;BR /&gt;&lt;BR /&gt;DATE: MAR 04 2004 CLASS: UX_PROD_OTHER TAPES: 030127 FILES: /sybdump&lt;BR /&gt;&lt;BR /&gt;test.ksh contains :-&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;cat ./test.in | awk -F" " ' \&lt;BR /&gt; BEGIN {}&lt;BR /&gt; /UX_PROD TAPES/ {print $1" "$2" "$3" "$4" "$5" "$6" "$7" &lt;BR /&gt;"$8" &lt;BR /&gt;"$9"&lt;BR /&gt;&lt;BR /&gt;"$10" &lt;BR /&gt;"$11" "$12" "$13" "$14" "$15}&lt;BR /&gt; /UX_PROD_OTHER TAPES/ {print $1" "$2" "$3" "$4" "$5" "$6" "$7" &lt;BR /&gt;"$8" "$9"&lt;BR /&gt;"$10" "$11" "$12" "$13" "$14" "$15}'&lt;BR /&gt;&lt;BR /&gt;Run ksh ./test.ksh and the output is as you wanted :-&lt;BR /&gt;&lt;BR /&gt;DATE: MAR 03 2004 CLASS: UX_PROD TAPES: &lt;BR /&gt;030043 &lt;BR /&gt;030260 &lt;BR /&gt;030233 &lt;BR /&gt;030237 FILES: /oracle* /oracle1* /oracle2*&lt;BR /&gt;DATE: MAR 04 2004 CLASS: UX_PROD_OTHER TAPES: &lt;BR /&gt;030127 FILES: /sybdump&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;&lt;BR /&gt;Dave.</description>
      <pubDate>Mon, 15 Mar 2004 12:26:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sed-command-help/m-p/3219053#M169976</guid>
      <dc:creator>David Burgess</dc:creator>
      <dc:date>2004-03-15T12:26:12Z</dc:date>
    </item>
    <item>
      <title>Re: sed command help!!!</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sed-command-help/m-p/3219054#M169977</link>
      <description>Or some nasty "perl" that Merijn could do in about nine bytes.&lt;BR /&gt; &lt;BR /&gt;perl -ne '($s,$m,$e)=(/(.+TAPES:)(.+)(FILES.+)/);$m=~s/ /&lt;BR /&gt;/g;print "${s}${m}${e}\n"' &lt;DATAFILE&gt;&lt;/DATAFILE&gt;</description>
      <pubDate>Mon, 15 Mar 2004 12:30:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sed-command-help/m-p/3219054#M169977</guid>
      <dc:creator>Mark Grant</dc:creator>
      <dc:date>2004-03-15T12:30:24Z</dc:date>
    </item>
    <item>
      <title>Re: sed command help!!!</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sed-command-help/m-p/3219055#M169978</link>
      <description>Hey Jean-Luc,&lt;BR /&gt;&lt;BR /&gt;   Your awk works great!!  But how can I make it so the &lt;BR /&gt; is after the numbers not before as I showed incorrectly.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 15 Mar 2004 14:19:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sed-command-help/m-p/3219055#M169978</guid>
      <dc:creator>Cesar Fernandes</dc:creator>
      <dc:date>2004-03-15T14:19:48Z</dc:date>
    </item>
    <item>
      <title>Re: sed command help!!!</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sed-command-help/m-p/3219056#M169979</link>
      <description>Hey Jean-Luc,&lt;BR /&gt;  &lt;BR /&gt;  Never mind I got it.&lt;BR /&gt;&lt;BR /&gt;awk '&lt;BR /&gt;{&lt;BR /&gt;flg=0;&lt;BR /&gt;n1=split($0,tab);&lt;BR /&gt;for(i=1; i &amp;lt;= n1;i++) {&lt;BR /&gt;if(tab[i]=="FILES:") flg=0;&lt;BR /&gt;if(flg==2) printf("&lt;BR /&gt;");&lt;BR /&gt;if(flg==1) flg=2;&lt;BR /&gt;printf("%s ",tab[i]);&lt;BR /&gt;if(tab[i]=="TAPES:") flg=1;&lt;BR /&gt;}&lt;BR /&gt;printf("\n");&lt;BR /&gt;}' $INPUT.tmp3 &amp;gt; $INPUT.tmp2&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;THANKS ALOT!!!&lt;BR /&gt;&lt;BR /&gt;And Thanks to all who answered.</description>
      <pubDate>Mon, 15 Mar 2004 14:44:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sed-command-help/m-p/3219056#M169979</guid>
      <dc:creator>Cesar Fernandes</dc:creator>
      <dc:date>2004-03-15T14:44:11Z</dc:date>
    </item>
  </channel>
</rss>

