<?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 question, tricky one in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/sed-question-tricky-one/m-p/3558835#M226115</link>
    <description>Oops, here it is with ${variable}- &lt;BR /&gt; &lt;BR /&gt;perl -n -e "print if 1../${variable}/" yourfile&lt;BR /&gt; &lt;BR /&gt;-- Rod Hills</description>
    <pubDate>Mon, 06 Jun 2005 15:16:14 GMT</pubDate>
    <dc:creator>Rodney Hills</dc:creator>
    <dc:date>2005-06-06T15:16:14Z</dc:date>
    <item>
      <title>sed question, tricky one</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sed-question-tricky-one/m-p/3558833#M226113</link>
      <description>I am trying to get from a general sed command to get the first line up to the line containing a regexp like below:&lt;BR /&gt;sed -e '1,/${variable}/!d'&lt;BR /&gt;but it does not satisfy the condition when the ${variable} is part of the first line. &lt;BR /&gt;Could someone please comment and recommend a fix. Thank you.</description>
      <pubDate>Mon, 06 Jun 2005 14:36:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sed-question-tricky-one/m-p/3558833#M226113</guid>
      <dc:creator>Mike_Ca Li</dc:creator>
      <dc:date>2005-06-06T14:36:22Z</dc:date>
    </item>
    <item>
      <title>Re: sed question, tricky one</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sed-question-tricky-one/m-p/3558834#M226114</link>
      <description>You could do the following with perl-&lt;BR /&gt; &lt;BR /&gt;perl -n -e 'print if 1../abc/' yourfile&lt;BR /&gt; &lt;BR /&gt;HTH&lt;BR /&gt; &lt;BR /&gt;-- Rod Hills</description>
      <pubDate>Mon, 06 Jun 2005 15:14:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sed-question-tricky-one/m-p/3558834#M226114</guid>
      <dc:creator>Rodney Hills</dc:creator>
      <dc:date>2005-06-06T15:14:45Z</dc:date>
    </item>
    <item>
      <title>Re: sed question, tricky one</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sed-question-tricky-one/m-p/3558835#M226115</link>
      <description>Oops, here it is with ${variable}- &lt;BR /&gt; &lt;BR /&gt;perl -n -e "print if 1../${variable}/" yourfile&lt;BR /&gt; &lt;BR /&gt;-- Rod Hills</description>
      <pubDate>Mon, 06 Jun 2005 15:16:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sed-question-tricky-one/m-p/3558835#M226115</guid>
      <dc:creator>Rodney Hills</dc:creator>
      <dc:date>2005-06-06T15:16:14Z</dc:date>
    </item>
    <item>
      <title>Re: sed question, tricky one</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sed-question-tricky-one/m-p/3558836#M226116</link>
      <description>Thanks for reply. I guess that it can't be done with sed?</description>
      <pubDate>Mon, 06 Jun 2005 15:21:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sed-question-tricky-one/m-p/3558836#M226116</guid>
      <dc:creator>Mike_Ca Li</dc:creator>
      <dc:date>2005-06-06T15:21:58Z</dc:date>
    </item>
    <item>
      <title>Re: sed question, tricky one</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sed-question-tricky-one/m-p/3558837#M226117</link>
      <description>One thing needs to be made very clear. Are you looking explicitly for ${variable} or aou looking for the instantiation of ${variable}? Note that instantiation will not take place within single quotes but will within double quotes so that your problem may be a shell rather than sed problem.</description>
      <pubDate>Mon, 06 Jun 2005 15:31:37 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sed-question-tricky-one/m-p/3558837#M226117</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2005-06-06T15:31:37Z</dc:date>
    </item>
    <item>
      <title>Re: sed question, tricky one</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sed-question-tricky-one/m-p/3558838#M226118</link>
      <description>Hi:&lt;BR /&gt;There was a typo, the sed line should be:&lt;BR /&gt;sed -e '1,/'${variable}'/!d'  filename &lt;BR /&gt;or&lt;BR /&gt;sed -e '1,/"${ckpoint}"/!d' &lt;BR /&gt;But here is what I don't understnad. The content of filename:&lt;BR /&gt;---start---&lt;BR /&gt;2005011211.zip&lt;BR /&gt;2004201004.zip&lt;BR /&gt;2005012004.zip&lt;BR /&gt;2005011950.zip&lt;BR /&gt;2005013102.zip&lt;BR /&gt;---end---&lt;BR /&gt;&lt;BR /&gt; sed  -e 1,/2005011211.zip/!d filename will return all  the 5 lines which is rather strange.&lt;BR /&gt;sed -e /2005013102.zip/!d will only return &lt;BR /&gt;2004201004.zip&lt;BR /&gt;&lt;BR /&gt;The perl -n -e 'print if 1../2005011211.zip/' will return 2005011211.zip&lt;BR /&gt;&lt;BR /&gt;Is that a sed issue? Thanks&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 06 Jun 2005 15:51:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sed-question-tricky-one/m-p/3558838#M226118</guid>
      <dc:creator>Mike_Ca Li</dc:creator>
      <dc:date>2005-06-06T15:51:20Z</dc:date>
    </item>
    <item>
      <title>Re: sed question, tricky one</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sed-question-tricky-one/m-p/3558839#M226119</link>
      <description>You can try as,&lt;BR /&gt;&lt;BR /&gt;------test.log---------&lt;BR /&gt;2005011211.zip&lt;BR /&gt;2004201004.zip&lt;BR /&gt;2005012004.zip&lt;BR /&gt;2005011950.zip&lt;BR /&gt;2005013102.zip&lt;BR /&gt;&lt;BR /&gt;Execution to print from 1st line to 2005011950.zip as,&lt;BR /&gt;&lt;BR /&gt;# sed -n '{1,/2005011950.zip/p;}q' test.log&lt;BR /&gt;&lt;BR /&gt;It will do it.&lt;BR /&gt;&lt;BR /&gt;hth.&lt;BR /&gt;</description>
      <pubDate>Tue, 07 Jun 2005 00:08:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sed-question-tricky-one/m-p/3558839#M226119</guid>
      <dc:creator>Muthukumar_5</dc:creator>
      <dc:date>2005-06-07T00:08:40Z</dc:date>
    </item>
    <item>
      <title>Re: sed question, tricky one</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sed-question-tricky-one/m-p/3558840#M226120</link>
      <description>You can also try as,&lt;BR /&gt;&lt;BR /&gt;# sed -e '{1,/2005012004.zip/!d;}q' test.log for printing from 1 to 2005012004.zip pattern.&lt;BR /&gt;&lt;BR /&gt;hth.</description>
      <pubDate>Tue, 07 Jun 2005 00:09:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sed-question-tricky-one/m-p/3558840#M226120</guid>
      <dc:creator>Muthukumar_5</dc:creator>
      <dc:date>2005-06-07T00:09:32Z</dc:date>
    </item>
    <item>
      <title>Re: sed question, tricky one</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sed-question-tricky-one/m-p/3558841#M226121</link>
      <description>$ sed -e '{1,/2005012004.zip/!d;}q' test.log&lt;BR /&gt;sed: -e expression #1, char 24: Extra characters after command&lt;BR /&gt;&lt;BR /&gt;$ sed -e '{1,/2005012004.zip/!d;}' test.log&lt;BR /&gt;2005011211.zip&lt;BR /&gt;2004201004.zip&lt;BR /&gt;2005012004.zip&lt;BR /&gt;&lt;BR /&gt;$ sed -e '{1,/200501121.zip/!d;}' test.log&lt;BR /&gt;2005011211.zip&lt;BR /&gt;2004201004.zip&lt;BR /&gt;2005012004.zip&lt;BR /&gt;2005011950.zip&lt;BR /&gt;2005013102.zip&lt;BR /&gt;&lt;BR /&gt;That was not I was looking for. Thanks for trying. I'll go with the perl solution</description>
      <pubDate>Wed, 08 Jun 2005 20:38:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sed-question-tricky-one/m-p/3558841#M226121</guid>
      <dc:creator>Mike_Ca Li</dc:creator>
      <dc:date>2005-06-08T20:38:44Z</dc:date>
    </item>
    <item>
      <title>Re: sed question, tricky one</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sed-question-tricky-one/m-p/3558842#M226122</link>
      <description>hi mike&lt;BR /&gt;&lt;BR /&gt;here is the portion of a output from man sed&lt;BR /&gt;&lt;BR /&gt;Same as above but use shell or environment variables var1 and var2 in&lt;BR /&gt;      search and replacement strings:&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;           sed "s/$var1/$var2/" file1 &amp;gt;file1.out&lt;BR /&gt;&lt;BR /&gt;      or&lt;BR /&gt;&lt;BR /&gt;           sed 's/'$var1'/'$var2'/' file1 &amp;gt;file1.out&lt;BR /&gt;&lt;BR /&gt;      Multiple substitutions in a single command:&lt;BR /&gt;&lt;BR /&gt;hope it sprays some light to your query...&lt;BR /&gt;&lt;BR /&gt;Regards&lt;BR /&gt;&lt;BR /&gt;Vinod K</description>
      <pubDate>Sat, 18 Jun 2005 03:31:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sed-question-tricky-one/m-p/3558842#M226122</guid>
      <dc:creator>vinod_25</dc:creator>
      <dc:date>2005-06-18T03:31:36Z</dc:date>
    </item>
  </channel>
</rss>

