<?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: manipulate string with perl in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/manipulate-string-with-perl/m-p/3859304#M98289</link>
    <description>TIMTOWTDI:&lt;BR /&gt;&lt;BR /&gt;my $newdate = sprintf "%04d-%02d-%02d %02d:%02d", unpack "A4A2A2 A2A2", $date;&lt;BR /&gt;&lt;BR /&gt;# perldoc -f pack&lt;BR /&gt;# man perlpacktut&lt;BR /&gt;# man perlfunc&lt;BR /&gt;&lt;BR /&gt;Enjoy, Have FUN! H.Merijn</description>
    <pubDate>Fri, 08 Sep 2006 07:18:44 GMT</pubDate>
    <dc:creator>H.Merijn Brand (procura</dc:creator>
    <dc:date>2006-09-08T07:18:44Z</dc:date>
    <item>
      <title>manipulate string with perl</title>
      <link>https://community.hpe.com/t5/operating-system-linux/manipulate-string-with-perl/m-p/3859298#M98283</link>
      <description>Hi, &lt;BR /&gt;&lt;BR /&gt;I have a date&lt;BR /&gt;&lt;BR /&gt;my $date = 200609061700;&lt;BR /&gt;&lt;BR /&gt;That I need to look like&lt;BR /&gt;&lt;BR /&gt;2006-09-06 17:00&lt;BR /&gt;&lt;BR /&gt;At the moment I have got as far as&lt;BR /&gt;&lt;BR /&gt;my @date=split(//, $date);&lt;BR /&gt;&lt;BR /&gt;my $newdate = "@date[0,1,2,3]-@date[4,5]-@date[6,7] @date[8,9]:@date[10,11]";&lt;BR /&gt;&lt;BR /&gt;$newdate =~ s/\s//g;&lt;BR /&gt;&lt;BR /&gt;Which gives&lt;BR /&gt;&lt;BR /&gt;2006-09-0617:00&lt;BR /&gt;&lt;BR /&gt;Any help appreciated&lt;BR /&gt;&lt;BR /&gt;TIA&lt;BR /&gt;&lt;BR /&gt;Steve</description>
      <pubDate>Fri, 08 Sep 2006 07:00:57 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/manipulate-string-with-perl/m-p/3859298#M98283</guid>
      <dc:creator>steven Burgess_2</dc:creator>
      <dc:date>2006-09-08T07:00:57Z</dc:date>
    </item>
    <item>
      <title>Re: manipulate string with perl</title>
      <link>https://community.hpe.com/t5/operating-system-linux/manipulate-string-with-perl/m-p/3859299#M98284</link>
      <description>my ($y,$m, $d, $H, $M) = unpack "A4A2A2 A2A2", $date;&lt;BR /&gt;&lt;BR /&gt;You can also look at modules Date::Calc, and Date::Manip&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://search.cpan.org/search?query=Date%3A%3A&amp;amp;mode=all" target="_blank"&gt;http://search.cpan.org/search?query=Date%3A%3A&amp;amp;mode=all&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Enjoy, Have FUN! H.Merijn</description>
      <pubDate>Fri, 08 Sep 2006 07:09:55 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/manipulate-string-with-perl/m-p/3859299#M98284</guid>
      <dc:creator>H.Merijn Brand (procura</dc:creator>
      <dc:date>2006-09-08T07:09:55Z</dc:date>
    </item>
    <item>
      <title>Re: manipulate string with perl</title>
      <link>https://community.hpe.com/t5/operating-system-linux/manipulate-string-with-perl/m-p/3859300#M98285</link>
      <description>and the output then&lt;BR /&gt;&lt;BR /&gt;my $newdate = "$y-$m-$d $H:$M";&lt;BR /&gt;&lt;BR /&gt;Enjoy, Have FUN! H.Merijn</description>
      <pubDate>Fri, 08 Sep 2006 07:11:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/manipulate-string-with-perl/m-p/3859300#M98285</guid>
      <dc:creator>H.Merijn Brand (procura</dc:creator>
      <dc:date>2006-09-08T07:11:17Z</dc:date>
    </item>
    <item>
      <title>Re: manipulate string with perl</title>
      <link>https://community.hpe.com/t5/operating-system-linux/manipulate-string-with-perl/m-p/3859301#M98286</link>
      <description>Hi&lt;BR /&gt;&lt;BR /&gt;Sorry, I have obtained the date from a file name. I need to insert that date into my database in the format that it expects for the column&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;&lt;BR /&gt;Steve</description>
      <pubDate>Fri, 08 Sep 2006 07:11:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/manipulate-string-with-perl/m-p/3859301#M98286</guid>
      <dc:creator>steven Burgess_2</dc:creator>
      <dc:date>2006-09-08T07:11:45Z</dc:date>
    </item>
    <item>
      <title>Re: manipulate string with perl</title>
      <link>https://community.hpe.com/t5/operating-system-linux/manipulate-string-with-perl/m-p/3859302#M98287</link>
      <description>Maybe not the best solution.&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/perl&lt;BR /&gt;&lt;BR /&gt;$date=200609061700;&lt;BR /&gt;&lt;BR /&gt;$year=substr $date, 0, 4;&lt;BR /&gt;$mnth=substr $date, 4, 2;&lt;BR /&gt;$day=substr $date, 6, 2;&lt;BR /&gt;$time=substr $date, 8, 5;&lt;BR /&gt;&lt;BR /&gt;my $newdate = "$year-$mnth-$day $time\n";&lt;BR /&gt;&lt;BR /&gt;print $newdate;&lt;BR /&gt;</description>
      <pubDate>Fri, 08 Sep 2006 07:13:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/manipulate-string-with-perl/m-p/3859302#M98287</guid>
      <dc:creator>Marvin Strong</dc:creator>
      <dc:date>2006-09-08T07:13:59Z</dc:date>
    </item>
    <item>
      <title>Re: manipulate string with perl</title>
      <link>https://community.hpe.com/t5/operating-system-linux/manipulate-string-with-perl/m-p/3859303#M98288</link>
      <description>Hi &lt;BR /&gt;&lt;BR /&gt;I was also looking a substr but could only work out from the examples how to insert one character. &lt;BR /&gt;&lt;BR /&gt;TIA&lt;BR /&gt;&lt;BR /&gt;Steve</description>
      <pubDate>Fri, 08 Sep 2006 07:14:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/manipulate-string-with-perl/m-p/3859303#M98288</guid>
      <dc:creator>steven Burgess_2</dc:creator>
      <dc:date>2006-09-08T07:14:48Z</dc:date>
    </item>
    <item>
      <title>Re: manipulate string with perl</title>
      <link>https://community.hpe.com/t5/operating-system-linux/manipulate-string-with-perl/m-p/3859304#M98289</link>
      <description>TIMTOWTDI:&lt;BR /&gt;&lt;BR /&gt;my $newdate = sprintf "%04d-%02d-%02d %02d:%02d", unpack "A4A2A2 A2A2", $date;&lt;BR /&gt;&lt;BR /&gt;# perldoc -f pack&lt;BR /&gt;# man perlpacktut&lt;BR /&gt;# man perlfunc&lt;BR /&gt;&lt;BR /&gt;Enjoy, Have FUN! H.Merijn</description>
      <pubDate>Fri, 08 Sep 2006 07:18:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/manipulate-string-with-perl/m-p/3859304#M98289</guid>
      <dc:creator>H.Merijn Brand (procura</dc:creator>
      <dc:date>2006-09-08T07:18:44Z</dc:date>
    </item>
    <item>
      <title>Re: manipulate string with perl</title>
      <link>https://community.hpe.com/t5/operating-system-linux/manipulate-string-with-perl/m-p/3859305#M98290</link>
      <description>opps I missed that you need a : between hour and min. You could just add two more substr for hour and min, then combine with mine. &lt;BR /&gt;&lt;BR /&gt;of course the unpack is a better solution than mine. I'm going to have dig into unpack more one of these days. &lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 08 Sep 2006 07:20:06 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/manipulate-string-with-perl/m-p/3859305#M98290</guid>
      <dc:creator>Marvin Strong</dc:creator>
      <dc:date>2006-09-08T07:20:06Z</dc:date>
    </item>
    <item>
      <title>Re: manipulate string with perl</title>
      <link>https://community.hpe.com/t5/operating-system-linux/manipulate-string-with-perl/m-p/3859306#M98291</link>
      <description>Thanks again&lt;BR /&gt;&lt;BR /&gt;Steve</description>
      <pubDate>Fri, 08 Sep 2006 07:24:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/manipulate-string-with-perl/m-p/3859306#M98291</guid>
      <dc:creator>steven Burgess_2</dc:creator>
      <dc:date>2006-09-08T07:24:43Z</dc:date>
    </item>
  </channel>
</rss>

