<?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: Dates in awk Scripts in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/dates-in-awk-scripts/m-p/3360353#M193932</link>
    <description>Yes, that's exactly what I needed... when I tried that here on my OS... I received the following error message: &lt;BR /&gt;&lt;BR /&gt;nawk: calling undefined function strftime&lt;BR /&gt; source line number 10&lt;BR /&gt;&lt;BR /&gt;So, there's something odd about my ability to recognize functions.  &lt;BR /&gt;&lt;BR /&gt;I'm currently using the following code:&lt;BR /&gt;&lt;BR /&gt;"date +'%Y%m%d'"| getline header_date&lt;BR /&gt;&lt;BR /&gt;I really appreciate your input and suggestion!</description>
    <pubDate>Wed, 18 Aug 2004 15:57:40 GMT</pubDate>
    <dc:creator>Carla L. Thompson</dc:creator>
    <dc:date>2004-08-18T15:57:40Z</dc:date>
    <item>
      <title>Dates in awk Scripts</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/dates-in-awk-scripts/m-p/3360350#M193929</link>
      <description>I'm trying to create a Header Record with a Date Stamp, and I can't figure out the syntax:&lt;BR /&gt;&lt;BR /&gt;The following doesn't work: &lt;BR /&gt;&lt;BR /&gt;BEGIN {&lt;BR /&gt;header_type = "H"&lt;BR /&gt;header_desc = "Display Name of File"&lt;BR /&gt;header_date = strftime("%y%m$d",systime())&lt;BR /&gt;header_filler = "||||"&lt;BR /&gt;&lt;BR /&gt;print  header_type "|" header_desc "|" header_date "|" header_filler&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;{&lt;BR /&gt;}&lt;BR /&gt;END {&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;Suggestions welcomed!</description>
      <pubDate>Wed, 18 Aug 2004 15:15:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/dates-in-awk-scripts/m-p/3360350#M193929</guid>
      <dc:creator>Carla L. Thompson</dc:creator>
      <dc:date>2004-08-18T15:15:44Z</dc:date>
    </item>
    <item>
      <title>Re: Dates in awk Scripts</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/dates-in-awk-scripts/m-p/3360351#M193930</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;I couldn't get it to work on HP-UX 11.11.  My awk complains about the strftime function.  I tried it on a Linux box and it seems to know about that function, and it seemed to work when I changed this line:&lt;BR /&gt;&lt;BR /&gt;header_date = strftime("%y%m$d",systime())&lt;BR /&gt;&lt;BR /&gt;to this:&lt;BR /&gt;&lt;BR /&gt;header_date = strftime("%y%m%d",systime())&lt;BR /&gt;&lt;BR /&gt;It seems happier with the '%d' instead of the '$d', and gives back something like this:&lt;BR /&gt;&lt;BR /&gt;H|Display Name of File|040818|||||&lt;BR /&gt;&lt;BR /&gt;Is that what you had in mind?&lt;BR /&gt;&lt;BR /&gt;JP&lt;BR /&gt;</description>
      <pubDate>Wed, 18 Aug 2004 15:42:02 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/dates-in-awk-scripts/m-p/3360351#M193930</guid>
      <dc:creator>John Poff</dc:creator>
      <dc:date>2004-08-18T15:42:02Z</dc:date>
    </item>
    <item>
      <title>Re: Dates in awk Scripts</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/dates-in-awk-scripts/m-p/3360352#M193931</link>
      <description>well strftime is a library function and isn't an awk command, so that isn't going to work.&lt;BR /&gt;&lt;BR /&gt;what will probably work for is the getline command used as: command | getline variable&lt;BR /&gt;&lt;BR /&gt;as your command use date.  see the man page for more information&lt;BR /&gt;&lt;BR /&gt;of course you could also pass the date as a variable, -v date=$(date) '{...&lt;BR /&gt;or as part of the environment  ENVIRON["date"]</description>
      <pubDate>Wed, 18 Aug 2004 15:52:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/dates-in-awk-scripts/m-p/3360352#M193931</guid>
      <dc:creator>curt larson_1</dc:creator>
      <dc:date>2004-08-18T15:52:12Z</dc:date>
    </item>
    <item>
      <title>Re: Dates in awk Scripts</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/dates-in-awk-scripts/m-p/3360353#M193932</link>
      <description>Yes, that's exactly what I needed... when I tried that here on my OS... I received the following error message: &lt;BR /&gt;&lt;BR /&gt;nawk: calling undefined function strftime&lt;BR /&gt; source line number 10&lt;BR /&gt;&lt;BR /&gt;So, there's something odd about my ability to recognize functions.  &lt;BR /&gt;&lt;BR /&gt;I'm currently using the following code:&lt;BR /&gt;&lt;BR /&gt;"date +'%Y%m%d'"| getline header_date&lt;BR /&gt;&lt;BR /&gt;I really appreciate your input and suggestion!</description>
      <pubDate>Wed, 18 Aug 2004 15:57:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/dates-in-awk-scripts/m-p/3360353#M193932</guid>
      <dc:creator>Carla L. Thompson</dc:creator>
      <dc:date>2004-08-18T15:57:40Z</dc:date>
    </item>
  </channel>
</rss>

