<?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: need awk Help from experts in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/need-awk-help-from-experts/m-p/4943867#M793604</link>
    <description>Muthukumar's solution is OK.&lt;BR /&gt;</description>
    <pubDate>Fri, 02 Dec 2005 01:52:37 GMT</pubDate>
    <dc:creator>Cem Tugrul</dc:creator>
    <dc:date>2005-12-02T01:52:37Z</dc:date>
    <item>
      <title>need awk Help from experts</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/need-awk-help-from-experts/m-p/4943853#M793590</link>
      <description>Hi Forum,&lt;BR /&gt;i have approx 500 files with .csv extension&lt;BR /&gt;and i want to produce a final report from these&lt;BR /&gt;csv files.ALL of theses files have such a kind of strings which i have to use on my report;&lt;BR /&gt;&lt;BR /&gt;Computer Name,Fully Qualified DNS Name,,0,Computer Name,&lt;BR /&gt;Memory,,Physical Memory,0,Total,&lt;BR /&gt;CPU,,CPU Properties,0,CPU Type,&lt;BR /&gt;&lt;BR /&gt;from the original file(csv file);&lt;BR /&gt;&lt;BR /&gt;Computer Name,Fully Qualified DNS Name,,0,Computer Name,MNTRANKTPC00938&lt;BR /&gt;&lt;BR /&gt;CPU,,CPU Properties,0,CPU Type,Unknown; 3000 MHz&lt;BR /&gt;&lt;BR /&gt;Memory,,Physical Memory,0,Total,190 MB&lt;BR /&gt;&lt;BR /&gt;so My report will be like;&lt;BR /&gt;&lt;BR /&gt;computer_name    cpu        mem&lt;BR /&gt;---------------  ----      ------   &lt;BR /&gt;MNTRANKTPC00938  3000 Mhz   190 Mb&lt;BR /&gt;&lt;BR /&gt;how can i produce such a kind of report via&lt;BR /&gt;awk?&lt;BR /&gt;&lt;BR /&gt;!!!Points start with 5!!!&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 01 Dec 2005 04:43:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/need-awk-help-from-experts/m-p/4943853#M793590</guid>
      <dc:creator>Cem Tugrul</dc:creator>
      <dc:date>2005-12-01T04:43:32Z</dc:date>
    </item>
    <item>
      <title>Re: need awk Help from experts</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/need-awk-help-from-experts/m-p/4943854#M793591</link>
      <description>From your example:&lt;BR /&gt;&lt;BR /&gt;# awk -F "," 'BEGIN{print "Computer_name  cpu   memory";}{printf $NF" ";}END{printf "\n";}' test.csv&lt;BR /&gt;Computer_name  cpu   memory&lt;BR /&gt;MNTRANKTPC00938  Unknown; 3000 MHz  190 MB&lt;BR /&gt;&lt;BR /&gt;Question:&lt;BR /&gt;&lt;BR /&gt;1) CPU,,CPU Properties,0,CPU Type,Unknown; 3000 MHz -- Is this format correct?&lt;BR /&gt;&lt;BR /&gt;2) Is every file contains only those 3 details?&lt;BR /&gt;&lt;BR /&gt;3) do you want to generate a final report with computer_name ...* and get names from differenct csv files and make combined report?&lt;BR /&gt;&lt;BR /&gt;hth.</description>
      <pubDate>Thu, 01 Dec 2005 04:54:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/need-awk-help-from-experts/m-p/4943854#M793591</guid>
      <dc:creator>Muthukumar_5</dc:creator>
      <dc:date>2005-12-01T04:54:20Z</dc:date>
    </item>
    <item>
      <title>Re: need awk Help from experts</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/need-awk-help-from-experts/m-p/4943855#M793592</link>
      <description>Can you get back the answer for the questions?&lt;BR /&gt;&lt;BR /&gt;I am continuing with available format as,&lt;BR /&gt;&lt;BR /&gt;( echo "computer_name     cpu     memory";&lt;BR /&gt;for file in `find &lt;DIRECTORY&gt;  -name "*.csv"`&lt;BR /&gt;do&lt;BR /&gt;  awk -F "," '!/^$/{ if ( $NF ~ "Unknown") { split ($NF,a,"; ");printf a[2]" ";}else {printf $NF" ";}}END{printf "\n"}' $file&lt;BR /&gt;done ) &amp;gt; final.report&lt;BR /&gt;&lt;BR /&gt;Change &lt;DIRECTORY&gt; which you want.&lt;BR /&gt;&lt;BR /&gt;hth.&lt;/DIRECTORY&gt;&lt;/DIRECTORY&gt;</description>
      <pubDate>Thu, 01 Dec 2005 05:07:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/need-awk-help-from-experts/m-p/4943855#M793592</guid>
      <dc:creator>Muthukumar_5</dc:creator>
      <dc:date>2005-12-01T05:07:08Z</dc:date>
    </item>
    <item>
      <title>Re: need awk Help from experts</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/need-awk-help-from-experts/m-p/4943856#M793593</link>
      <description>Muthukumar,&lt;BR /&gt;&lt;BR /&gt;1- yes.it is correct.This csv file is being&lt;BR /&gt;generated when the computer logon to domain&lt;BR /&gt;so normally there are more information in this file hardware-software information.so i&lt;BR /&gt;only selected the lines which i want to produce a report&lt;BR /&gt;&lt;BR /&gt;2- No.&lt;BR /&gt;3- Each *.csv file named as like the computername.so for example if MNTRANKTPC00938 logon to domain then it generates MNTRANKTPC00938.csv so information&lt;BR /&gt;cpu-mem-computer name information included in this file so i have to read all these *.csv files and get these information onto my report.&lt;BR /&gt;</description>
      <pubDate>Thu, 01 Dec 2005 05:08:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/need-awk-help-from-experts/m-p/4943856#M793593</guid>
      <dc:creator>Cem Tugrul</dc:creator>
      <dc:date>2005-12-01T05:08:10Z</dc:date>
    </item>
    <item>
      <title>Re: need awk Help from experts</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/need-awk-help-from-experts/m-p/4943857#M793594</link>
      <description>an example of a *.csv file&lt;BR /&gt;see the attachment.</description>
      <pubDate>Thu, 01 Dec 2005 05:15:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/need-awk-help-from-experts/m-p/4943857#M793594</guid>
      <dc:creator>Cem Tugrul</dc:creator>
      <dc:date>2005-12-01T05:15:22Z</dc:date>
    </item>
    <item>
      <title>Re: need awk Help from experts</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/need-awk-help-from-experts/m-p/4943858#M793595</link>
      <description>Try this solution:&lt;BR /&gt;&lt;BR /&gt;#!/bin/ksh&lt;BR /&gt;#report.ksh&lt;BR /&gt;&lt;BR /&gt;#USER Input - Needed&lt;BR /&gt;FINALREPORT_FILE=/tmp/final.report&lt;BR /&gt;CSV_DIRECTORY=/tmp/&lt;BR /&gt;&lt;BR /&gt;if [[ ! -f ${FINALREPORT_FILE ]]&lt;BR /&gt;then&lt;BR /&gt;  echo "Computer_Name    CPU     Memory" &amp;gt;| ${FINALREPORT_FILE}&lt;BR /&gt;fi  &lt;BR /&gt;&lt;BR /&gt;find ${CSV_DIRECTORY} -type f -name "*.csv" | while read file;&lt;BR /&gt;do&lt;BR /&gt;&lt;BR /&gt; awk -F "," '!/^$/{ if ( $NF ~ "Unknown") { split ($NF,a,"; ");printf a[2]" ";}else {printf $NF" ";}}END{printf "\n"}' ${file}&lt;BR /&gt;   &lt;BR /&gt;done &amp;gt;&amp;gt; ${FINALREPORT_FILE}&lt;BR /&gt;&lt;BR /&gt;# END&lt;BR /&gt;exit 0&lt;BR /&gt;&lt;BR /&gt;################&lt;BR /&gt;&lt;BR /&gt;Change USER Input part with your requirement.&lt;BR /&gt;&lt;BR /&gt;# chmod u+x report.ksh&lt;BR /&gt;# ./report.ksh&lt;BR /&gt;&lt;BR /&gt;hth.</description>
      <pubDate>Thu, 01 Dec 2005 05:23:06 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/need-awk-help-from-experts/m-p/4943858#M793595</guid>
      <dc:creator>Muthukumar_5</dc:creator>
      <dc:date>2005-12-01T05:23:06Z</dc:date>
    </item>
    <item>
      <title>Re: need awk Help from experts</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/need-awk-help-from-experts/m-p/4943859#M793596</link>
      <description>With your example csv file:&lt;BR /&gt;&lt;BR /&gt;Change script as,&lt;BR /&gt;&lt;BR /&gt;#!/bin/ksh&lt;BR /&gt;#report.ksh&lt;BR /&gt;&lt;BR /&gt;#USER Input - Needed&lt;BR /&gt;FINALREPORT_FILE=/tmp/final.report&lt;BR /&gt;CSV_DIRECTORY=/tmp/&lt;BR /&gt;&lt;BR /&gt;if [[ ! -f ${FINALREPORT_FILE ]]&lt;BR /&gt;then&lt;BR /&gt;echo "Computer_Name CPU Memory" &amp;gt;| ${FINALREPORT_FILE}&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;find ${CSV_DIRECTORY} -type f -name "*.csv" | while read file;&lt;BR /&gt;do&lt;BR /&gt;&lt;BR /&gt; computer=$(grep "Fully Qualified DNS Name" $file | grep -v "Class" | head -1 | awk -F"," '{ print $NF }')&lt;BR /&gt; cpu=$(grep "CPU.*Unknown" $file | awk -F"; " '{ print $NF }')&lt;BR /&gt; memory=$(grep "Physical Memory.*Total" $file | awk -F"," '{ print $NF }')&lt;BR /&gt;&lt;BR /&gt; echo "${computer}   ${cpu}    ${memory}&lt;BR /&gt;&lt;BR /&gt;done &amp;gt;&amp;gt; ${FINALREPORT_FILE}&lt;BR /&gt;&lt;BR /&gt;# END&lt;BR /&gt;exit 0&lt;BR /&gt;&lt;BR /&gt;Use it and post the result of success / failure.&lt;BR /&gt;&lt;BR /&gt;hth.</description>
      <pubDate>Thu, 01 Dec 2005 05:37:28 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/need-awk-help-from-experts/m-p/4943859#M793596</guid>
      <dc:creator>Muthukumar_5</dc:creator>
      <dc:date>2005-12-01T05:37:28Z</dc:date>
    </item>
    <item>
      <title>Re: need awk Help from experts</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/need-awk-help-from-experts/m-p/4943860#M793597</link>
      <description>sh report.sh &lt;BR /&gt;report.sh[8]: Syntax error at line 10 : `&amp;gt;' is not expected.&lt;BR /&gt;&lt;BR /&gt;#!/bin/ksh&lt;BR /&gt;#report.ksh&lt;BR /&gt;&lt;BR /&gt;#USER Input - Needed&lt;BR /&gt;FINALREPORT_FILE=/users/cemt/final.report&lt;BR /&gt;CSV_DIRECTORY=/users/cemt&lt;BR /&gt;&lt;BR /&gt;if [[ ! -f ${FINALREPORT_FILE ]]&lt;BR /&gt;then&lt;BR /&gt;echo "Computer_Name CPU Memory" &amp;gt; ${FINALREPORT_FILE}&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;find ${CSV_DIRECTORY} -type f -name "*.csv" | while read file;&lt;BR /&gt;do&lt;BR /&gt;&lt;BR /&gt;computer=$(grep "Fully Qualified DNS Name" $file | grep -v "Class" | head -1 | awk -F"," '{ print $NF }')&lt;BR /&gt;cpu=$(grep "CPU.*Unknown" $file | awk -F"; " '{ print $NF }')&lt;BR /&gt;memory=$(grep "Physical Memory.*Total" $file | awk -F"," '{ print $NF }')&lt;BR /&gt;&lt;BR /&gt;echo "${computer} ${cpu} ${memory}&lt;BR /&gt;&lt;BR /&gt;done &amp;gt;&amp;gt; ${FINALREPORT_FILE}&lt;BR /&gt;&lt;BR /&gt;# END&lt;BR /&gt;exit 0&lt;BR /&gt;</description>
      <pubDate>Thu, 01 Dec 2005 06:49:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/need-awk-help-from-experts/m-p/4943860#M793597</guid>
      <dc:creator>Cem Tugrul</dc:creator>
      <dc:date>2005-12-01T06:49:31Z</dc:date>
    </item>
    <item>
      <title>Re: need awk Help from experts</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/need-awk-help-from-experts/m-p/4943861#M793598</link>
      <description>not sure if it's the prob or not, but Muthukumar's example has "&amp;gt;|" and your cut/paste only shows "&amp;gt;".. either the forums stripped it off or you missed the pipe in your script.&lt;BR /&gt;&lt;BR /&gt;-denver</description>
      <pubDate>Thu, 01 Dec 2005 08:39:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/need-awk-help-from-experts/m-p/4943861#M793598</guid>
      <dc:creator>Denver Osborn</dc:creator>
      <dc:date>2005-12-01T08:39:05Z</dc:date>
    </item>
    <item>
      <title>Re: need awk Help from experts</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/need-awk-help-from-experts/m-p/4943862#M793599</link>
      <description>Hi Denver,&lt;BR /&gt;i fixed it up.but nothing changed!!!&lt;BR /&gt;</description>
      <pubDate>Thu, 01 Dec 2005 08:59:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/need-awk-help-from-experts/m-p/4943862#M793599</guid>
      <dc:creator>Cem Tugrul</dc:creator>
      <dc:date>2005-12-01T08:59:16Z</dc:date>
    </item>
    <item>
      <title>Re: need awk Help from experts</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/need-awk-help-from-experts/m-p/4943863#M793600</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;There is a missing curly brace.  The code should read:&lt;BR /&gt;&lt;BR /&gt;if [[ ! -f ${FINALREPORT_FILE} ]]&lt;BR /&gt;then&lt;BR /&gt;echo "Computer_Name CPU Memory" &amp;gt; ${FINALREPORT_FILE}&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;Note also that there is no pipe.  He is saying if the file doesn't exist, then create a new one with a heading line.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Thu, 01 Dec 2005 09:03:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/need-awk-help-from-experts/m-p/4943863#M793600</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2005-12-01T09:03:41Z</dc:date>
    </item>
    <item>
      <title>Re: need awk Help from experts</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/need-awk-help-from-experts/m-p/4943864#M793601</link>
      <description>Hi James,&lt;BR /&gt;You exactly right..&lt;BR /&gt;${FINALREPORT_FILE}&lt;BR /&gt;also i changed echo "${computer} ${cpu} ${memory}&lt;BR /&gt;&lt;BR /&gt;echo "${computer} ${cpu} ${memory}"&lt;BR /&gt;&lt;BR /&gt;Then script seems working and generated the report!!!!&lt;BR /&gt;&lt;BR /&gt;PS:&lt;BR /&gt;Hey Muthukumar,&lt;BR /&gt;pls send a reply because 10 is still waiting for you..&lt;BR /&gt;Thank's again!!!!&lt;BR /&gt; &lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 01 Dec 2005 09:13:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/need-awk-help-from-experts/m-p/4943864#M793601</guid>
      <dc:creator>Cem Tugrul</dc:creator>
      <dc:date>2005-12-01T09:13:41Z</dc:date>
    </item>
    <item>
      <title>Re: need awk Help from experts</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/need-awk-help-from-experts/m-p/4943865#M793602</link>
      <description>Hi (again) Cem:&lt;BR /&gt;&lt;BR /&gt;The key to debugging code is to look *near* the offending line.  Generally, you will find that the real cause of the error that doesn't make sense is a few lines ahead.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Thu, 01 Dec 2005 09:24:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/need-awk-help-from-experts/m-p/4943865#M793602</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2005-12-01T09:24:26Z</dc:date>
    </item>
    <item>
      <title>Re: need awk Help from experts</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/need-awk-help-from-experts/m-p/4943866#M793603</link>
      <description>Hi James,&lt;BR /&gt;You (again) right...&lt;BR /&gt;i sometimes mixe "seeing" &amp;amp; "looking" but&lt;BR /&gt;i know there is a nuance so that's the point..&lt;BR /&gt;&lt;BR /&gt;Greetings,&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 01 Dec 2005 09:36:13 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/need-awk-help-from-experts/m-p/4943866#M793603</guid>
      <dc:creator>Cem Tugrul</dc:creator>
      <dc:date>2005-12-01T09:36:13Z</dc:date>
    </item>
    <item>
      <title>Re: need awk Help from experts</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/need-awk-help-from-experts/m-p/4943867#M793604</link>
      <description>Muthukumar's solution is OK.&lt;BR /&gt;</description>
      <pubDate>Fri, 02 Dec 2005 01:52:37 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/need-awk-help-from-experts/m-p/4943867#M793604</guid>
      <dc:creator>Cem Tugrul</dc:creator>
      <dc:date>2005-12-02T01:52:37Z</dc:date>
    </item>
  </channel>
</rss>

