<?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 / awk replace in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/sed-awk-replace/m-p/5173137#M682175</link>
    <description>Thanks all, &lt;BR /&gt;I got it working.. &lt;BR /&gt;&lt;BR /&gt;I just used a perl -pi -e replace. &lt;BR /&gt;&lt;BR /&gt;I redefined the string in the template to  readable BASEMONTH, BASEDAY, BASEYEAR then defined the variables to replace the information in the RUN file from the template. &lt;BR /&gt;&lt;BR /&gt;export day=`date +%d`&lt;BR /&gt;export month=`date +%m`&lt;BR /&gt;export year=`date +%Y` &lt;BR /&gt;&lt;BR /&gt;cp class_curlConnect.php.template class_curlConnect.php&lt;BR /&gt;perl -pi -e s/BASEMONTH/${month}/g class_curlConnect.php&lt;BR /&gt;perl -pi -e s/BASEDAY/${day}/g class_curlConnect.php&lt;BR /&gt;perl -pi -e s/BASEYEAR/${year}/g class_curlConnect.php&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
    <pubDate>Tue, 05 May 2009 12:02:08 GMT</pubDate>
    <dc:creator>rmueller58</dc:creator>
    <dc:date>2009-05-05T12:02:08Z</dc:date>
    <item>
      <title>sed / awk replace</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sed-awk-replace/m-p/5173130#M682168</link>
      <description>All, &lt;BR /&gt;&lt;BR /&gt;I have a string in a template, I want to build a date query into.. &lt;BR /&gt;&lt;BR /&gt;The original string is below: &lt;BR /&gt;COMPLETE_DATE&amp;amp;SMON=04&amp;amp;SDAY=30&amp;amp;SYEAR=2009&amp;amp;EMON=04&amp;amp;EDAY=30&amp;amp;EYEAR=2009&lt;BR /&gt;&lt;BR /&gt;I have a template with that entry in. I want to use this template to do a search/replace string based on standard unix date for "today"&lt;BR /&gt;ie:&lt;BR /&gt;SMON and EMON = `date +%m`&lt;BR /&gt;SDAY and EDAY = `date +d` &lt;BR /&gt;SYEAR and EYEAR = `date +Y` &lt;BR /&gt;&lt;BR /&gt;can someone show me the reg expression on which characters I'd need to escape? I am guessing the &amp;amp; and = need escaped, Any other ideas on what I could do? &lt;BR /&gt;&lt;BR /&gt;I appreciate it.. Rex M</description>
      <pubDate>Mon, 04 May 2009 18:19:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sed-awk-replace/m-p/5173130#M682168</guid>
      <dc:creator>rmueller58</dc:creator>
      <dc:date>2009-05-04T18:19:15Z</dc:date>
    </item>
    <item>
      <title>Re: sed / awk replace</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sed-awk-replace/m-p/5173131#M682169</link>
      <description>huh???&lt;BR /&gt;&lt;BR /&gt;What the template do you want to replace?? What portion of the string noted should be replaced, as you're getting strings of numbers, so I guess they need to go on the right side of the equals.  &lt;BR /&gt;&lt;BR /&gt;something like COMPLETE_DAT&amp;amp;SMON=$SMON.... perhaps?</description>
      <pubDate>Mon, 04 May 2009 19:50:06 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sed-awk-replace/m-p/5173131#M682169</guid>
      <dc:creator>OldSchool</dc:creator>
      <dc:date>2009-05-04T19:50:06Z</dc:date>
    </item>
    <item>
      <title>Re: sed / awk replace</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sed-awk-replace/m-p/5173132#M682170</link>
      <description>Old School. &lt;BR /&gt;&lt;BR /&gt;The "main file" is a php curl I am needing to cron a query at night against a website/database..  &lt;BR /&gt;&lt;BR /&gt;If I use a copy of the original the "date" is in one location in the file: &lt;BR /&gt;COMPLETE_DATE&amp;amp;SMON=04&amp;amp;SDAY=30&amp;amp;SYEAR=2009&amp;amp;EMON=04&amp;amp;EDAY=30&amp;amp;EYEAR=2009&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I need to replace "04", "30", "2009" with the actual unix system date in a sed replace of the COMPLETE DATE&lt;BR /&gt;&lt;BR /&gt;I need to REPLACE the dates in the COMPLETE_DATE and replace it with &lt;BR /&gt;&lt;BR /&gt;day=`date +%d`&lt;BR /&gt;month=`date +%m`&lt;BR /&gt;year=`date +%Y`&lt;BR /&gt;&lt;BR /&gt;I can call the PHP script as a subshell, but I need to edit the script prior to running it so the date is current. &lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 04 May 2009 19:59:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sed-awk-replace/m-p/5173132#M682170</guid>
      <dc:creator>rmueller58</dc:creator>
      <dc:date>2009-05-04T19:59:40Z</dc:date>
    </item>
    <item>
      <title>Re: sed / awk replace</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sed-awk-replace/m-p/5173133#M682171</link>
      <description>&amp;gt;The original string is below:&lt;BR /&gt;COMPLETE_DATE&amp;amp;SMON=04&amp;amp;SDAY=30&amp;amp;SYEAR=2009&amp;amp;EMON=04&amp;amp;EDAY=30&amp;amp;E&lt;BR /&gt;YEAR=2009&lt;BR /&gt;&lt;BR /&gt;(I would think if you had a template you would have MM, DD and YYYY instead of actual numbers?)&lt;BR /&gt;&lt;BR /&gt;&amp;gt;I am guessing the &amp;amp; and = need escaped,&lt;BR /&gt;&lt;BR /&gt;Just "&amp;amp;", "=" isn't special.&lt;BR /&gt;&lt;BR /&gt;MM=$(date +%m)&lt;BR /&gt;DD=$(date +%d)&lt;BR /&gt;YYYY=$(date +%Y)&lt;BR /&gt;sed -e "s/\&amp;amp;SMON=04/\&amp;amp;SMON=$MM/" -e "s/\&amp;amp;EMON=04/\&amp;amp;EMON=$MM/" \&lt;BR /&gt;    -e "s/\&amp;amp;SDAY=30/\&amp;amp;SDAY=$DD/" -e "s/\&amp;amp;EDAY=30/\&amp;amp;EDAY=$DD/" \&lt;BR /&gt;    -e "s/\&amp;amp;SYEAR=2009/\&amp;amp;SYEAR=$YYYY/" -e "s/\&amp;amp;EYEAR=2009/\&amp;amp;EYEAR=$YYYY/" file</description>
      <pubDate>Tue, 05 May 2009 02:34:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sed-awk-replace/m-p/5173133#M682171</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2009-05-05T02:34:15Z</dc:date>
    </item>
    <item>
      <title>Re: sed / awk replace</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sed-awk-replace/m-p/5173134#M682172</link>
      <description>&lt;!--!*#--&gt;&amp;gt; (I would think if you had a template [...]&lt;BR /&gt;&lt;BR /&gt;So would I, but what do I know?&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&amp;gt; [...] &amp;amp; and = need escaped [...]&lt;BR /&gt;&lt;BR /&gt;For my information only, are you from&lt;BR /&gt;Missouri, or is there someplace else where&lt;BR /&gt;someone would not say "need to be escaped"?</description>
      <pubDate>Tue, 05 May 2009 04:09:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sed-awk-replace/m-p/5173134#M682172</guid>
      <dc:creator>Steven Schweda</dc:creator>
      <dc:date>2009-05-05T04:09:43Z</dc:date>
    </item>
    <item>
      <title>Re: sed / awk replace</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sed-awk-replace/m-p/5173135#M682173</link>
      <description>&lt;!--!*#--&gt;&lt;BR /&gt;to print this out you could just use the date command with custom formatting like this:&lt;BR /&gt;&lt;BR /&gt;# date +"COMPLETE_DATE&amp;amp;SMON="%m"&amp;amp;SDAY="%d"&amp;amp;SYEAR="%Y"&amp;amp;EMON="%m"&amp;amp;EDAY="%d"&amp;amp;EYEAR="%Y&lt;BR /&gt;COMPLETE_DATE&amp;amp;SMON=05&amp;amp;SDAY=05&amp;amp;SYEAR=2009&amp;amp;EMON=05&amp;amp;EDAY=05&amp;amp;EYEAR=2009&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 05 May 2009 08:46:47 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sed-awk-replace/m-p/5173135#M682173</guid>
      <dc:creator>Viktor Balogh</dc:creator>
      <dc:date>2009-05-05T08:46:47Z</dc:date>
    </item>
    <item>
      <title>Re: sed / awk replace</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sed-awk-replace/m-p/5173136#M682174</link>
      <description>&lt;!--!*#--&gt;ouch, the command would be:&lt;BR /&gt;&lt;BR /&gt;# date +"COMPLETE_DATE&amp;amp;SMON="%m"&amp;amp;SDAY="%d"&amp;amp;SYEAR="%Y"&amp;amp;EMON="%m"&amp;amp;EDAY="%d"&amp;amp;EYEAR="%Y&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 05 May 2009 08:54:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sed-awk-replace/m-p/5173136#M682174</guid>
      <dc:creator>Viktor Balogh</dc:creator>
      <dc:date>2009-05-05T08:54:05Z</dc:date>
    </item>
    <item>
      <title>Re: sed / awk replace</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sed-awk-replace/m-p/5173137#M682175</link>
      <description>Thanks all, &lt;BR /&gt;I got it working.. &lt;BR /&gt;&lt;BR /&gt;I just used a perl -pi -e replace. &lt;BR /&gt;&lt;BR /&gt;I redefined the string in the template to  readable BASEMONTH, BASEDAY, BASEYEAR then defined the variables to replace the information in the RUN file from the template. &lt;BR /&gt;&lt;BR /&gt;export day=`date +%d`&lt;BR /&gt;export month=`date +%m`&lt;BR /&gt;export year=`date +%Y` &lt;BR /&gt;&lt;BR /&gt;cp class_curlConnect.php.template class_curlConnect.php&lt;BR /&gt;perl -pi -e s/BASEMONTH/${month}/g class_curlConnect.php&lt;BR /&gt;perl -pi -e s/BASEDAY/${day}/g class_curlConnect.php&lt;BR /&gt;perl -pi -e s/BASEYEAR/${year}/g class_curlConnect.php&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 05 May 2009 12:02:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sed-awk-replace/m-p/5173137#M682175</guid>
      <dc:creator>rmueller58</dc:creator>
      <dc:date>2009-05-05T12:02:08Z</dc:date>
    </item>
  </channel>
</rss>

