<?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 AWK confusion in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/awk-confusion/m-p/3972176#M95357</link>
    <description>I am trying to do some mass conversions of epoch time, to m/d/y hh:mm:ss formatted time.  I have acquired an awk script from the internet that converts epoch time (epoch_time.awk is attached to this thread).&lt;BR /&gt;&lt;BR /&gt;The script works well when I run it from the command line and pass the epoch time string.&lt;BR /&gt;&lt;BR /&gt; # ./epoch_time.awk 1168097143                                   &lt;BR /&gt;20070106152543&lt;BR /&gt;&lt;BR /&gt;My problem is that this is not working when I am trying to use it from within a for loop or while loop.  Such as:&lt;BR /&gt;&lt;BR /&gt;# for i in $(cat myfile)&lt;BR /&gt;do&lt;BR /&gt;./epoch_time.awk ${i}&lt;BR /&gt;done&lt;BR /&gt;19700101000000&lt;BR /&gt;19700101000000&lt;BR /&gt;19700101000000&lt;BR /&gt;19700101000000&lt;BR /&gt;19700101000000&lt;BR /&gt;19700101000000&lt;BR /&gt;&lt;BR /&gt;# head myfile&lt;BR /&gt;"1017942629"&lt;BR /&gt;"1018292324"&lt;BR /&gt;"1023462896"&lt;BR /&gt;"1023463449"&lt;BR /&gt;"1023469166"&lt;BR /&gt;&lt;BR /&gt;It makes no difference to epoch_time.awk if the values have quotes around them or not.&lt;BR /&gt;&lt;BR /&gt;This may be a case of not being able to see the forest for the trees.  But I am confused and can't see where the problem may lie.  &lt;BR /&gt;&lt;BR /&gt;Any help is appreciated.</description>
    <pubDate>Thu, 29 Mar 2007 11:38:53 GMT</pubDate>
    <dc:creator>Patrick Wallek</dc:creator>
    <dc:date>2007-03-29T11:38:53Z</dc:date>
    <item>
      <title>AWK confusion</title>
      <link>https://community.hpe.com/t5/operating-system-linux/awk-confusion/m-p/3972176#M95357</link>
      <description>I am trying to do some mass conversions of epoch time, to m/d/y hh:mm:ss formatted time.  I have acquired an awk script from the internet that converts epoch time (epoch_time.awk is attached to this thread).&lt;BR /&gt;&lt;BR /&gt;The script works well when I run it from the command line and pass the epoch time string.&lt;BR /&gt;&lt;BR /&gt; # ./epoch_time.awk 1168097143                                   &lt;BR /&gt;20070106152543&lt;BR /&gt;&lt;BR /&gt;My problem is that this is not working when I am trying to use it from within a for loop or while loop.  Such as:&lt;BR /&gt;&lt;BR /&gt;# for i in $(cat myfile)&lt;BR /&gt;do&lt;BR /&gt;./epoch_time.awk ${i}&lt;BR /&gt;done&lt;BR /&gt;19700101000000&lt;BR /&gt;19700101000000&lt;BR /&gt;19700101000000&lt;BR /&gt;19700101000000&lt;BR /&gt;19700101000000&lt;BR /&gt;19700101000000&lt;BR /&gt;&lt;BR /&gt;# head myfile&lt;BR /&gt;"1017942629"&lt;BR /&gt;"1018292324"&lt;BR /&gt;"1023462896"&lt;BR /&gt;"1023463449"&lt;BR /&gt;"1023469166"&lt;BR /&gt;&lt;BR /&gt;It makes no difference to epoch_time.awk if the values have quotes around them or not.&lt;BR /&gt;&lt;BR /&gt;This may be a case of not being able to see the forest for the trees.  But I am confused and can't see where the problem may lie.  &lt;BR /&gt;&lt;BR /&gt;Any help is appreciated.</description>
      <pubDate>Thu, 29 Mar 2007 11:38:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/awk-confusion/m-p/3972176#M95357</guid>
      <dc:creator>Patrick Wallek</dc:creator>
      <dc:date>2007-03-29T11:38:53Z</dc:date>
    </item>
    <item>
      <title>Re: AWK confusion</title>
      <link>https://community.hpe.com/t5/operating-system-linux/awk-confusion/m-p/3972177#M95358</link>
      <description>Hmmm....Let's try attaching that file again.....&lt;BR /&gt;&lt;BR /&gt;epoch_time.awk hopefully attached this time.</description>
      <pubDate>Thu, 29 Mar 2007 11:41:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/awk-confusion/m-p/3972177#M95358</guid>
      <dc:creator>Patrick Wallek</dc:creator>
      <dc:date>2007-03-29T11:41:24Z</dc:date>
    </item>
    <item>
      <title>Re: AWK confusion</title>
      <link>https://community.hpe.com/t5/operating-system-linux/awk-confusion/m-p/3972178#M95359</link>
      <description>Patrick,&lt;BR /&gt;&lt;BR /&gt;its the double quotes - this works&lt;BR /&gt;&lt;BR /&gt;for i in $(cat myfile | cut -d\" -f 2)&lt;BR /&gt;do&lt;BR /&gt;./epoch_time.awk ${i}&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;HTH&lt;BR /&gt;&lt;BR /&gt;Duncan</description>
      <pubDate>Thu, 29 Mar 2007 11:49:55 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/awk-confusion/m-p/3972178#M95359</guid>
      <dc:creator>Duncan Edmonstone</dc:creator>
      <dc:date>2007-03-29T11:49:55Z</dc:date>
    </item>
    <item>
      <title>Re: AWK confusion</title>
      <link>https://community.hpe.com/t5/operating-system-linux/awk-confusion/m-p/3972179#M95360</link>
      <description>&lt;!--!*#--&gt;Hi,&lt;BR /&gt;&lt;BR /&gt;of course is matters, whether your values in the file are quoted or not. Try&lt;BR /&gt;&lt;BR /&gt;for i in $(&lt;MYFILE&gt;&lt;/MYFILE&gt;do&lt;BR /&gt;    eval ./epoch_time.awk ${i}&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;as a shortcut to eliminate the quotes.&lt;BR /&gt;&lt;BR /&gt;mfG Peter&lt;BR /&gt;</description>
      <pubDate>Thu, 29 Mar 2007 11:49:56 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/awk-confusion/m-p/3972179#M95360</guid>
      <dc:creator>Peter Nikitka</dc:creator>
      <dc:date>2007-03-29T11:49:56Z</dc:date>
    </item>
    <item>
      <title>Re: AWK confusion</title>
      <link>https://community.hpe.com/t5/operating-system-linux/awk-confusion/m-p/3972180#M95361</link>
      <description>It's the quotes. Strip them!&lt;BR /&gt;&lt;BR /&gt;fwiw... I don't care for any scripts with hardcoded day tables. Yuck.&lt;BR /&gt;&lt;BR /&gt;Cheers,&lt;BR /&gt;Hein.&lt;BR /&gt;</description>
      <pubDate>Thu, 29 Mar 2007 11:53:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/awk-confusion/m-p/3972180#M95361</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2007-03-29T11:53:31Z</dc:date>
    </item>
    <item>
      <title>Re: AWK confusion</title>
      <link>https://community.hpe.com/t5/operating-system-linux/awk-confusion/m-p/3972181#M95362</link>
      <description>Well %$%#$%@$#%$#%!!!!!!!&lt;BR /&gt;&lt;BR /&gt;I thought I tried stripping the quotes from the values in 'myfile'.  Apparently not.  &lt;BR /&gt;&lt;BR /&gt;I guess what was throwing me off was that I had tried running the epoch_time.awk from the command line with the value quoted and it returned the correct value.&lt;BR /&gt;&lt;BR /&gt;Live and learn.......&lt;BR /&gt;&lt;BR /&gt;Thanks for pointing out what should've been fairly obvious.&lt;BR /&gt;</description>
      <pubDate>Thu, 29 Mar 2007 12:00:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/awk-confusion/m-p/3972181#M95362</guid>
      <dc:creator>Patrick Wallek</dc:creator>
      <dc:date>2007-03-29T12:00:01Z</dc:date>
    </item>
    <item>
      <title>Re: AWK confusion</title>
      <link>https://community.hpe.com/t5/operating-system-linux/awk-confusion/m-p/3972182#M95363</link>
      <description>... and Patrick, why in the Wide World of Sports would you call an awk script for what is a one-liner in Perl using time() and localtime() or gmtime().</description>
      <pubDate>Thu, 29 Mar 2007 12:00:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/awk-confusion/m-p/3972182#M95363</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2007-03-29T12:00:23Z</dc:date>
    </item>
    <item>
      <title>Re: AWK confusion</title>
      <link>https://community.hpe.com/t5/operating-system-linux/awk-confusion/m-p/3972183#M95364</link>
      <description>Because I haven't found / taken / made the "time" to learn much Perl yet.</description>
      <pubDate>Thu, 29 Mar 2007 12:01:57 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/awk-confusion/m-p/3972183#M95364</guid>
      <dc:creator>Patrick Wallek</dc:creator>
      <dc:date>2007-03-29T12:01:57Z</dc:date>
    </item>
    <item>
      <title>Re: AWK confusion</title>
      <link>https://community.hpe.com/t5/operating-system-linux/awk-confusion/m-p/3972184#M95365</link>
      <description>Patrick..&lt;BR /&gt;&lt;BR /&gt;On the live and learn...&lt;BR /&gt;&lt;BR /&gt;May I finish that sentence with 'perl' &lt;BR /&gt;&lt;BR /&gt;:-)   :-)&lt;BR /&gt;&lt;BR /&gt;You'll be in Vegas right?&lt;BR /&gt;We'll have a beer and i'll get you going on Perl :-)&lt;BR /&gt;&lt;BR /&gt; perl -ne 'chomp;s/"//g;@t=localtime($_); printf ("%4d%02d%02d%02d%02d%02d\n", $t[5]+1900, $t[4]+1, $t[3], $t[2], $t[1], $t[0])' myfile&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 29 Mar 2007 12:11:04 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/awk-confusion/m-p/3972184#M95365</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2007-03-29T12:11:04Z</dc:date>
    </item>
    <item>
      <title>Re: AWK confusion</title>
      <link>https://community.hpe.com/t5/operating-system-linux/awk-confusion/m-p/3972185#M95366</link>
      <description>Hi Patrick:&lt;BR /&gt;&lt;BR /&gt;A bit late I am, but even shorter with Perl:&lt;BR /&gt;&lt;BR /&gt;# perl -MPOSIX -ne 'print strftime("%Y%m%d%H%M%S\n",localtime($_))' file&lt;BR /&gt;&lt;BR /&gt;The nice part is that the directives to 'strftime' are as you find them in the manpages.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Thu, 29 Mar 2007 12:59:13 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/awk-confusion/m-p/3972185#M95366</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2007-03-29T12:59:13Z</dc:date>
    </item>
    <item>
      <title>Re: AWK confusion</title>
      <link>https://community.hpe.com/t5/operating-system-linux/awk-confusion/m-p/3972186#M95367</link>
      <description>Hein / JRF,&lt;BR /&gt;&lt;BR /&gt;Thanks for the PERL snippets.  Those will come in handy.&lt;BR /&gt;&lt;BR /&gt;I would say there's about a 90% chance that I will be in Las Vegas, although I don't know for sure yet.</description>
      <pubDate>Thu, 29 Mar 2007 13:10:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/awk-confusion/m-p/3972186#M95367</guid>
      <dc:creator>Patrick Wallek</dc:creator>
      <dc:date>2007-03-29T13:10:18Z</dc:date>
    </item>
  </channel>
</rss>

