<?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: file content in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/file-content/m-p/3655804#M102495</link>
    <description>Hi Muthu,&lt;BR /&gt;&lt;BR /&gt;One more thing before i made my final points.&lt;BR /&gt;Is it possible to test if the ENDTIME field contains the date and time format like yyyymmdd-hhmmss?&lt;BR /&gt;I am asking this this because some files have the correct format and others do not have.&lt;BR /&gt;My plan is to correct the wrong format then process it. If it is already correct then it will process them as is.&lt;BR /&gt;I need to process 10,000 files in my hp-ux system. Thanks!&lt;BR /&gt;</description>
    <pubDate>Mon, 24 Oct 2005 03:58:07 GMT</pubDate>
    <dc:creator>Pando</dc:creator>
    <dc:date>2005-10-24T03:58:07Z</dc:date>
    <item>
      <title>file content</title>
      <link>https://community.hpe.com/t5/operating-system-linux/file-content/m-p/3655796#M102487</link>
      <description>dear gurus,&lt;BR /&gt;&lt;BR /&gt;I have a file that contains the following line&lt;BR /&gt;&lt;BR /&gt;...&lt;BR /&gt;...&lt;BR /&gt;ENDTIME,""      - &lt;BR /&gt;...&lt;BR /&gt;...&lt;BR /&gt;&lt;BR /&gt;ENDTIME record format is not correct so i need to manipulate it. &lt;BR /&gt;&lt;BR /&gt;I have created a script like this:&lt;BR /&gt;&lt;BR /&gt;endtime=$(awk -F "," '/ENDTIME/ {print $2}' $FILE)&lt;BR /&gt;if [ $endtime = "/""      -     /" ]&lt;BR /&gt;  then &lt;BR /&gt;    lot=$(basename $FILE)&lt;BR /&gt;    lot=`echo $edlot|sed 's/\.tdf//'`&lt;BR /&gt;    lotdate=$(echo $edlot|awk -F _ '{print $4}')&lt;BR /&gt;    lottime=$(echo $edlot|awk -F _ '{print $5}')&lt;BR /&gt;    echo $year$lotdate"-"$lottime&lt;BR /&gt;    exit&lt;BR /&gt;  fi&lt;BR /&gt;&lt;BR /&gt;but nothing seems to happen.&lt;BR /&gt;&lt;BR /&gt;I need to replace the endtime record if it has erraneous content. &lt;BR /&gt;&lt;BR /&gt;Maximum points to all correct answers.&lt;BR /&gt;</description>
      <pubDate>Mon, 24 Oct 2005 01:51:56 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/file-content/m-p/3655796#M102487</guid>
      <dc:creator>Pando</dc:creator>
      <dc:date>2005-10-24T01:51:56Z</dc:date>
    </item>
    <item>
      <title>Re: file content</title>
      <link>https://community.hpe.com/t5/operating-system-linux/file-content/m-p/3655797#M102488</link>
      <description>Your file format is like this,&lt;BR /&gt;&lt;BR /&gt;...&lt;BR /&gt;...&lt;BR /&gt;ENDTIME,"" -&lt;BR /&gt;...&lt;BR /&gt;...&lt;BR /&gt;&lt;BR /&gt;how do you want to generate from this? plz specify the output you are executing. And more, your script is having more problem (without exact shell format). Revert back with details to get HUGE response(s).&lt;BR /&gt;&lt;BR /&gt;-Muthu&lt;BR /&gt;</description>
      <pubDate>Mon, 24 Oct 2005 02:01:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/file-content/m-p/3655797#M102488</guid>
      <dc:creator>Muthukumar_5</dc:creator>
      <dc:date>2005-10-24T02:01:20Z</dc:date>
    </item>
    <item>
      <title>Re: file content</title>
      <link>https://community.hpe.com/t5/operating-system-linux/file-content/m-p/3655798#M102489</link>
      <description>Hi Muthu,&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Basically i have a filename named BGC5043_6678_DC2_1005_154042_S3.TDF.&lt;BR /&gt;The content of the file has a line ENDTIME,"" - , in it.&lt;BR /&gt;All i want is to replace "" - with the correct time format (yearmmdd-hhmmss). which is actually within the filename (4th &amp;amp; 5th field).&lt;BR /&gt;The shell format is POSIX.</description>
      <pubDate>Mon, 24 Oct 2005 02:23:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/file-content/m-p/3655798#M102489</guid>
      <dc:creator>Pando</dc:creator>
      <dc:date>2005-10-24T02:23:20Z</dc:date>
    </item>
    <item>
      <title>Re: file content</title>
      <link>https://community.hpe.com/t5/operating-system-linux/file-content/m-p/3655799#M102490</link>
      <description>Script:&lt;BR /&gt;&lt;BR /&gt;#!/bin/ksh&lt;BR /&gt;# Use format as: script.ksh &lt;FILENAME&gt;&lt;BR /&gt;# EXample:&lt;BR /&gt;# ./script.ksh BGC5043_6678_DC2_1005_154042_S3.TDF&lt;BR /&gt;&lt;BR /&gt;FILE=${1}&lt;BR /&gt;YD=$(echo "${FILE}" | awk -F"_" '{ print $4 }')&lt;BR /&gt;THS=$(echo "${FILE}" | awk -F"_" '{ print $5 }')&lt;BR /&gt;&lt;BR /&gt;perl -pi -e "s%"" -%$YD-$THS%g" ${FILE}&lt;BR /&gt;&lt;BR /&gt;# END #&lt;BR /&gt;exit 0&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;It will work.&lt;BR /&gt;&lt;BR /&gt;# perl -pi -e "s%"" -%$YD-$THS%g" ${FILE}&lt;BR /&gt;# cat *.TDF&lt;BR /&gt;...&lt;BR /&gt;...&lt;BR /&gt;ENDTIME,""1005-154042&lt;BR /&gt;...&lt;BR /&gt;...&lt;BR /&gt;# &lt;BR /&gt;&lt;BR /&gt;-Muthu&lt;/FILENAME&gt;</description>
      <pubDate>Mon, 24 Oct 2005 03:07:57 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/file-content/m-p/3655799#M102490</guid>
      <dc:creator>Muthukumar_5</dc:creator>
      <dc:date>2005-10-24T03:07:57Z</dc:date>
    </item>
    <item>
      <title>Re: file content</title>
      <link>https://community.hpe.com/t5/operating-system-linux/file-content/m-p/3655800#M102491</link>
      <description>Hi Muthu,&lt;BR /&gt;&lt;BR /&gt;In your output file, ENDTIME,""1005-154042&lt;BR /&gt;the "" should be 2005.</description>
      <pubDate>Mon, 24 Oct 2005 03:24:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/file-content/m-p/3655800#M102491</guid>
      <dc:creator>Pando</dc:creator>
      <dc:date>2005-10-24T03:24:43Z</dc:date>
    </item>
    <item>
      <title>Re: file content</title>
      <link>https://community.hpe.com/t5/operating-system-linux/file-content/m-p/3655801#M102492</link>
      <description>A single line script:&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;# perl -pi -e 'BEGIN{($YD,$HMS)=(split /_/,$ARGV[0])[3,4];}{s%ENDTIME,"".*$%ENDTIME,$YD-$HMS%g;}' &lt;FILENAME&gt;&lt;BR /&gt;&lt;BR /&gt;# perl -pi -e 'BEGIN{($YD,$HMS)=(split /_/,$ARGV[0])[3,4];}{s%ENDTIME,"".*$%ENDTIME,$YD-$HMS%g;}' BGC5043_6678_DC2_1005_154042_S3.TDF&lt;BR /&gt;&lt;BR /&gt;# cat BGC5043_6678_DC2_1005_154042_S3.TDF&lt;BR /&gt;...&lt;BR /&gt;...&lt;BR /&gt;ENDTIME,1005-154042&lt;BR /&gt;...&lt;BR /&gt;...&lt;BR /&gt;&lt;BR /&gt;-Muthu&lt;/FILENAME&gt;</description>
      <pubDate>Mon, 24 Oct 2005 03:26:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/file-content/m-p/3655801#M102492</guid>
      <dc:creator>Muthukumar_5</dc:creator>
      <dc:date>2005-10-24T03:26:58Z</dc:date>
    </item>
    <item>
      <title>Re: file content</title>
      <link>https://community.hpe.com/t5/operating-system-linux/file-content/m-p/3655802#M102493</link>
      <description>Use this script:&lt;BR /&gt;&lt;BR /&gt;#!/bin/ksh&lt;BR /&gt;# Use format as: script.ksh &lt;FILENAME&gt;&lt;BR /&gt;# EXample:&lt;BR /&gt;# ./script.ksh BGC5043_6678_DC2_1005_154042_S3.TDF&lt;BR /&gt;&lt;BR /&gt;FILE=${1}&lt;BR /&gt;Y=$(date +'%Y')&lt;BR /&gt;MD=$(echo "${FILE}" | awk -F"_" '{ print $4 }')&lt;BR /&gt;THS=$(echo "${FILE}" | awk -F"_" '{ print $5 }')&lt;BR /&gt;&lt;BR /&gt;perl -pi -e "s%ENDTIME,"".*$%ENDTIME,$Y$YD-$THS%g" ${FILE}&lt;BR /&gt;&lt;BR /&gt;# END #&lt;BR /&gt;exit 0&lt;BR /&gt;&lt;BR /&gt;# ksh script.ksh &lt;FILENAME&gt;&lt;BR /&gt;will do it.&lt;BR /&gt;&lt;BR /&gt;-Muthu&lt;/FILENAME&gt;&lt;/FILENAME&gt;</description>
      <pubDate>Mon, 24 Oct 2005 03:30:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/file-content/m-p/3655802#M102493</guid>
      <dc:creator>Muthukumar_5</dc:creator>
      <dc:date>2005-10-24T03:30:09Z</dc:date>
    </item>
    <item>
      <title>Re: file content</title>
      <link>https://community.hpe.com/t5/operating-system-linux/file-content/m-p/3655803#M102494</link>
      <description>Single line:&lt;BR /&gt;&lt;BR /&gt;# perl -pi -e 'BEGIN{$Y=`date +'%Y'`;chomp($Y);($YD,$HMS)=(split /_/,$ARGV[0])[3,4];}{s%ENDTIME,"".*$%ENDTIME,$Y$YD-$HMS%g;}' &lt;FILENAME&gt;&lt;BR /&gt;&lt;BR /&gt;It will update into the file itself.&lt;BR /&gt;&lt;BR /&gt;hth.&lt;BR /&gt;&lt;/FILENAME&gt;</description>
      <pubDate>Mon, 24 Oct 2005 03:41:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/file-content/m-p/3655803#M102494</guid>
      <dc:creator>Muthukumar_5</dc:creator>
      <dc:date>2005-10-24T03:41:35Z</dc:date>
    </item>
    <item>
      <title>Re: file content</title>
      <link>https://community.hpe.com/t5/operating-system-linux/file-content/m-p/3655804#M102495</link>
      <description>Hi Muthu,&lt;BR /&gt;&lt;BR /&gt;One more thing before i made my final points.&lt;BR /&gt;Is it possible to test if the ENDTIME field contains the date and time format like yyyymmdd-hhmmss?&lt;BR /&gt;I am asking this this because some files have the correct format and others do not have.&lt;BR /&gt;My plan is to correct the wrong format then process it. If it is already correct then it will process them as is.&lt;BR /&gt;I need to process 10,000 files in my hp-ux system. Thanks!&lt;BR /&gt;</description>
      <pubDate>Mon, 24 Oct 2005 03:58:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/file-content/m-p/3655804#M102495</guid>
      <dc:creator>Pando</dc:creator>
      <dc:date>2005-10-24T03:58:07Z</dc:date>
    </item>
    <item>
      <title>Re: file content</title>
      <link>https://community.hpe.com/t5/operating-system-linux/file-content/m-p/3655805#M102496</link>
      <description># perl -pi -e 'BEGIN{$Y=`date +'%Y'`;chomp($Y);($YD,$HMS)=(split /_/,$ARGV[0])[3,4];}{s%ENDTIME,"".*$%ENDTIME,$Y$YD-$HMS%g;}'&lt;BR /&gt;&lt;BR /&gt;Will change when ENDTIME is having format as,&lt;BR /&gt;&lt;BR /&gt;ENDTIME,""&lt;SPACE&gt;&lt;ANYTHING after="" this=""&gt;&lt;BR /&gt;&lt;BR /&gt;To make check if ENDTIME,YYYYMMDD-HHMMSS&lt;BR /&gt;&lt;BR /&gt;# perl -pi -e 'BEGIN{$Y=`date +'%Y'`;chomp($Y);($YD,$HMS)=(split /_/,$ARGV[0])[3,4];}{s%ENDTIME,"".*$%ENDTIME,$Y$YD-$HMS%g if /ENDTIME,\d{6}-\d{6}/;}' &lt;FILENAME1&gt; &lt;FILENAME2&gt;&lt;BR /&gt;&lt;BR /&gt;-Muthu&lt;BR /&gt;&lt;/FILENAME2&gt;&lt;/FILENAME1&gt;&lt;/ANYTHING&gt;&lt;/SPACE&gt;</description>
      <pubDate>Mon, 24 Oct 2005 06:33:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/file-content/m-p/3655805#M102496</guid>
      <dc:creator>Muthukumar_5</dc:creator>
      <dc:date>2005-10-24T06:33:08Z</dc:date>
    </item>
    <item>
      <title>Re: file content</title>
      <link>https://community.hpe.com/t5/operating-system-linux/file-content/m-p/3655806#M102497</link>
      <description>It's kinda non-perl to call external (unportable) date commands to generate a date stamp where perl has fine (and much faster) builtins to do that&lt;BR /&gt;&lt;BR /&gt;&amp;gt; Is it possible to test if the ENDTIME&lt;BR /&gt;&amp;gt; field contains the date and time format&lt;BR /&gt;&amp;gt; like yyyymmdd-hhmmss?&lt;BR /&gt;&lt;BR /&gt;either&lt;BR /&gt;&lt;BR /&gt;# perl -e'BEGIN{@d=localtime;$ENDTIME=sprintf"%4d%02d%02d-%02d%02d%02d",$d[5]+1900,$d[4]+1,@d[3,2,1,0]} ...'&lt;BR /&gt;&lt;BR /&gt;or (but slower) using POSIX&lt;BR /&gt;&lt;BR /&gt;# perl -MPOSIX=strftime -e'BEGIN{ENDTIME=strftime"%Y%m%d-%H%M%S",localtime} ...'&lt;BR /&gt;&lt;BR /&gt;Enjoy, Have FUN! H.Merijn</description>
      <pubDate>Mon, 24 Oct 2005 06:48:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/file-content/m-p/3655806#M102497</guid>
      <dc:creator>H.Merijn Brand (procura</dc:creator>
      <dc:date>2005-10-24T06:48:43Z</dc:date>
    </item>
    <item>
      <title>Re: file content</title>
      <link>https://community.hpe.com/t5/operating-system-linux/file-content/m-p/3655807#M102498</link>
      <description>Hi Muthu,&lt;BR /&gt;&lt;BR /&gt;Can you explain to me the line below. I think this would check if ENDTIME,YYYYMMDD-HHMMSS&lt;BR /&gt;,if not what would happen?&lt;BR /&gt;&lt;BR /&gt;# perl -pi -e 'BEGIN{$Y=`date +'%Y'`;chomp($Y);($YD,$HMS)=(split /_/,$ARGV[0])[3,4];}{s%ENDTIME,"".*$%E&lt;BR /&gt;NDTIME,$Y$YD-$HMS%g if /ENDTIME,\d{6}-\d{6}/;}' &lt;FILENAME1&gt; &lt;FILENAME2&gt;&lt;/FILENAME2&gt;&lt;/FILENAME1&gt;</description>
      <pubDate>Wed, 26 Oct 2005 02:47:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/file-content/m-p/3655807#M102498</guid>
      <dc:creator>Pando</dc:creator>
      <dc:date>2005-10-26T02:47:31Z</dc:date>
    </item>
  </channel>
</rss>

