<?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: sed usage for report generation in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/sed-usage-for-report-generation/m-p/2598036#M855287</link>
    <description>Shawn,&lt;BR /&gt;&lt;BR /&gt;It's simple. You just need to make these modifications.&lt;BR /&gt;...&lt;BR /&gt;....&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;FILE=/tmp/file$$&lt;BR /&gt;sed '/^*/d' $1 &amp;gt; $FILE (If the comment is with *)&lt;BR /&gt;...&lt;BR /&gt;..&lt;BR /&gt;...&lt;BR /&gt;done&lt;BR /&gt;rm $FILE&lt;BR /&gt;&lt;BR /&gt;Sorry for the overlook.&lt;BR /&gt;&lt;BR /&gt;-Sri</description>
    <pubDate>Fri, 19 Oct 2001 19:04:25 GMT</pubDate>
    <dc:creator>Sridhar Bhaskarla</dc:creator>
    <dc:date>2001-10-19T19:04:25Z</dc:date>
    <item>
      <title>sed usage for report generation</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sed-usage-for-report-generation/m-p/2598031#M855282</link>
      <description>I have two files, lastlog_model and report. See attached.&lt;BR /&gt;&lt;BR /&gt;1. lastlog_model&lt;BR /&gt;&lt;BR /&gt;It is a ASCII file that contains stanzas with the last login attributes for users.Each stanza is identified by a use name and contains attributes inthe Attribute=Value form. Each attribute is ended by a new line character, and each stanza is ended by an additional new-line character.&lt;BR /&gt;&lt;BR /&gt;2. report&lt;BR /&gt;&lt;BR /&gt;This is the file I want to generate for system accounting. &lt;BR /&gt;&lt;BR /&gt;I am looking a script which can generate the second file according to the original one, file lastlog_model from AIX, but I know the shell should be same. &lt;BR /&gt;&lt;BR /&gt;Any reply will be really appreciate.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 19 Oct 2001 14:59:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sed-usage-for-report-generation/m-p/2598031#M855282</guid>
      <dc:creator>Victor_5</dc:creator>
      <dc:date>2001-10-19T14:59:46Z</dc:date>
    </item>
    <item>
      <title>Re: sed usage for report generation</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sed-usage-for-report-generation/m-p/2598032#M855283</link>
      <description>Try the following bit of awk, it probably won't be perfect for you, but it can be abused:&lt;BR /&gt;&lt;BR /&gt;awk '&lt;BR /&gt;BEGIN {&lt;BR /&gt;   FS="\n";&lt;BR /&gt;   RS="";&lt;BR /&gt;   OFS=" ";&lt;BR /&gt;   ORS="\n";&lt;BR /&gt;}&lt;BR /&gt;{&lt;BR /&gt;   for (i=1;i&amp;lt;=NF;i++) {&lt;BR /&gt;      printf "%s ", substr($i,index($i,"=")+1)&lt;BR /&gt;   }&lt;BR /&gt;   printf "\n"&lt;BR /&gt;}' &lt;FILE&gt;&lt;BR /&gt;&lt;BR /&gt;HTH&lt;BR /&gt;&lt;BR /&gt;dave&lt;/FILE&gt;</description>
      <pubDate>Fri, 19 Oct 2001 15:29:28 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sed-usage-for-report-generation/m-p/2598032#M855283</guid>
      <dc:creator>David Lodge</dc:creator>
      <dc:date>2001-10-19T15:29:28Z</dc:date>
    </item>
    <item>
      <title>Re: sed usage for report generation</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sed-usage-for-report-generation/m-p/2598033#M855284</link>
      <description>Shawn,&lt;BR /&gt;&lt;BR /&gt;Try this. This should work if your input file looks exactly the way you attached.&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/ksh&lt;BR /&gt;&lt;BR /&gt;if [ $# -ne 1 ]&lt;BR /&gt;then&lt;BR /&gt;echo "Usage: $0 inputfile"&lt;BR /&gt;exit 1&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;FILE=$1&lt;BR /&gt;printf "%-20.30s  %-20.20s \n"  "user_name" "Time Last Login"     &lt;BR /&gt;echo ""                                                           &lt;BR /&gt;for i in `grep -v "=" $FILE`                                       &lt;BR /&gt;do                                                                &lt;BR /&gt;USER=`echo $i|sed 's/://'`                                        &lt;BR /&gt;LINE=`sed -n '/'$i'/,/time_last_login/p' $FILE |grep last_login`   &lt;BR /&gt;UTIME=`echo $LINE|awk '{print $3}'`                               &lt;BR /&gt;printf "%-20.30s  %-20.20s \n"  "$USER" "$UTIME"                  &lt;BR /&gt;done                                                              &lt;BR /&gt;-Sri</description>
      <pubDate>Fri, 19 Oct 2001 15:37:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sed-usage-for-report-generation/m-p/2598033#M855284</guid>
      <dc:creator>Sridhar Bhaskarla</dc:creator>
      <dc:date>2001-10-19T15:37:44Z</dc:date>
    </item>
    <item>
      <title>Re: sed usage for report generation</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sed-usage-for-report-generation/m-p/2598034#M855285</link>
      <description>As you can see, you want to use awk or some shell script. sed is a  stream text editor, for manipulating streams of characters.</description>
      <pubDate>Fri, 19 Oct 2001 16:02:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sed-usage-for-report-generation/m-p/2598034#M855285</guid>
      <dc:creator>harry d brown jr</dc:creator>
      <dc:date>2001-10-19T16:02:50Z</dc:date>
    </item>
    <item>
      <title>Re: sed usage for report generation</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sed-usage-for-report-generation/m-p/2598035#M855286</link>
      <description>Hi Sridar:&lt;BR /&gt;&lt;BR /&gt;Your script has a mini problem: there are some comments in the beginning of lastlog_model, the loop(grep -v "=" $FILE) does not filter those comments.&lt;BR /&gt;&lt;BR /&gt;However, I still want to give you 10 points, your script is perfect, thank you so much. &lt;BR /&gt;&lt;BR /&gt;Have a nice weekend.&lt;BR /&gt;&lt;BR /&gt;Shawn&lt;BR /&gt;</description>
      <pubDate>Fri, 19 Oct 2001 18:41:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sed-usage-for-report-generation/m-p/2598035#M855286</guid>
      <dc:creator>Victor_5</dc:creator>
      <dc:date>2001-10-19T18:41:21Z</dc:date>
    </item>
    <item>
      <title>Re: sed usage for report generation</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/sed-usage-for-report-generation/m-p/2598036#M855287</link>
      <description>Shawn,&lt;BR /&gt;&lt;BR /&gt;It's simple. You just need to make these modifications.&lt;BR /&gt;...&lt;BR /&gt;....&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;FILE=/tmp/file$$&lt;BR /&gt;sed '/^*/d' $1 &amp;gt; $FILE (If the comment is with *)&lt;BR /&gt;...&lt;BR /&gt;..&lt;BR /&gt;...&lt;BR /&gt;done&lt;BR /&gt;rm $FILE&lt;BR /&gt;&lt;BR /&gt;Sorry for the overlook.&lt;BR /&gt;&lt;BR /&gt;-Sri</description>
      <pubDate>Fri, 19 Oct 2001 19:04:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/sed-usage-for-report-generation/m-p/2598036#M855287</guid>
      <dc:creator>Sridhar Bhaskarla</dc:creator>
      <dc:date>2001-10-19T19:04:25Z</dc:date>
    </item>
  </channel>
</rss>

