<?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: text processing in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/text-processing/m-p/3345546#M191571</link>
    <description>I missed out } at the end,&lt;BR /&gt;&lt;BR /&gt; modified as,&lt;BR /&gt;&lt;BR /&gt; awk '{ print "else if(name.equalsIgnoreCase(\""$0"))\n{\nsetNWDEMSGTYPESEQ(strBuff);\n}" }' file1&lt;BR /&gt;&lt;BR /&gt;Output:&lt;BR /&gt;=======&lt;BR /&gt;else if(name.equalsIgnoreCase("NWDEMSGTYPESEQ))&lt;BR /&gt;{&lt;BR /&gt;setNWDEMSGTYPESEQ(strBuff);&lt;BR /&gt;}&lt;BR /&gt;else if(name.equalsIgnoreCase("NWDEMSGCTRYTIME))&lt;BR /&gt;{&lt;BR /&gt;setNWDEMSGTYPESEQ(strBuff);&lt;BR /&gt;}&lt;BR /&gt;</description>
    <pubDate>Fri, 30 Jul 2004 10:26:09 GMT</pubDate>
    <dc:creator>Muthukumar_5</dc:creator>
    <dc:date>2004-07-30T10:26:09Z</dc:date>
    <item>
      <title>text processing</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/text-processing/m-p/3345539#M191564</link>
      <description>File 1:&lt;BR /&gt;&lt;BR /&gt;NWDEMSGTYPESEQ&lt;BR /&gt;NWDEMSGCTRYTIME&lt;BR /&gt;&lt;BR /&gt;File 2:&lt;BR /&gt;NWDE-MSG-TYPE-SEQ&lt;BR /&gt;NWDE-MSG-CTRY-TIME&lt;BR /&gt;&lt;BR /&gt;Now I need a output like &lt;BR /&gt;&lt;BR /&gt;echo else if (name.equalsIgnoreCase("&lt;FIRST-LINE 2nd="" file=""&gt;"))&lt;BR /&gt;{&lt;BR /&gt;setNWDEMSGTYPESEQ(strBuff);&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;I would like to loop to get a output somewhat like &lt;BR /&gt;&lt;BR /&gt;echo else if (name.equalsIgnoreCase("NWDE-MSG-TYPE-SEQ"))&lt;BR /&gt;{&lt;BR /&gt;set(strBuff);&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;quick 10 points!!&lt;/FIRST-LINE&gt;</description>
      <pubDate>Fri, 30 Jul 2004 06:12:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/text-processing/m-p/3345539#M191564</guid>
      <dc:creator>T G Manikandan</dc:creator>
      <dc:date>2004-07-30T06:12:38Z</dc:date>
    </item>
    <item>
      <title>Re: text processing</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/text-processing/m-p/3345540#M191565</link>
      <description>like&lt;BR /&gt;&lt;BR /&gt;echo else if (name.equalsIgnoreCase("NWDE-MSG-TYPE-SEQ"))&lt;BR /&gt;{&lt;BR /&gt;setNWDEMSGTYPESEQ(strBuff);&lt;BR /&gt;}&lt;BR /&gt;</description>
      <pubDate>Fri, 30 Jul 2004 06:37:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/text-processing/m-p/3345540#M191565</guid>
      <dc:creator>T G Manikandan</dc:creator>
      <dc:date>2004-07-30T06:37:12Z</dc:date>
    </item>
    <item>
      <title>Re: text processing</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/text-processing/m-p/3345541#M191566</link>
      <description>We can print it with echo or printf on command line to do simply ?! as like &lt;BR /&gt;&lt;BR /&gt;echo "echo else if(name.equalsIgnoreCase(\"$(tail -1 file2)\"))\n{\nset$(head -1 file1)(strBuff);\n}"&lt;BR /&gt;&lt;BR /&gt;printf "echo else if(name.equalsIgnoreCase(\"$(tail -1 file2)\"))\n{\nset$(head -1 file1)(strBuff);\n}"&lt;BR /&gt;&lt;BR /&gt; Delemit " character with \ &lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 30 Jul 2004 06:50:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/text-processing/m-p/3345541#M191566</guid>
      <dc:creator>Muthukumar_5</dc:creator>
      <dc:date>2004-07-30T06:50:14Z</dc:date>
    </item>
    <item>
      <title>Re: text processing</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/text-processing/m-p/3345542#M191567</link>
      <description>I have file with 10000 rows similarly</description>
      <pubDate>Fri, 30 Jul 2004 09:13:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/text-processing/m-p/3345542#M191567</guid>
      <dc:creator>T G Manikandan</dc:creator>
      <dc:date>2004-07-30T09:13:54Z</dc:date>
    </item>
    <item>
      <title>Re: text processing</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/text-processing/m-p/3345543#M191568</link>
      <description>I don't recognize that scripting language. Is it Python?&lt;BR /&gt;&lt;BR /&gt;If you just have plain text files, and rephrase the question, you might have more luck here with people knowing to do what you want in awk/sed/perl/sh&lt;BR /&gt;&lt;BR /&gt;Enjoy, Have FUN! H.Merijn [ who honoustly has no idea what to answer to the original question ]</description>
      <pubDate>Fri, 30 Jul 2004 09:18:52 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/text-processing/m-p/3345543#M191568</guid>
      <dc:creator>H.Merijn Brand (procura</dc:creator>
      <dc:date>2004-07-30T09:18:52Z</dc:date>
    </item>
    <item>
      <title>Re: text processing</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/text-processing/m-p/3345544#M191569</link>
      <description>Try this (if I understand the question, it might work) :&lt;BR /&gt;&lt;BR /&gt;$&amp;gt;perl&lt;BR /&gt;$fd1="file1";&lt;BR /&gt;$fd2="file2";&lt;BR /&gt;open fd1;&lt;BR /&gt;open fd2;&lt;BR /&gt;while (&lt;FD1&gt;) {&lt;BR /&gt;  $File1Line=$_;&lt;BR /&gt;  &lt;FD2&gt;;&lt;BR /&gt;  $File2Line=$_;&lt;BR /&gt;  $File1Line=~ s/\n//g;&lt;BR /&gt;  $File2Line=~ s/\n//g;&lt;BR /&gt;  print "echo else if (name.equalsIgnoreCase(\"$File2Line\"))\n";&lt;BR /&gt;  print "{\n";&lt;BR /&gt;  print "set$File1Line(strBuff);\n";&lt;BR /&gt;  print "}\n";&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;It outputs this from your original files :&lt;BR /&gt;&lt;BR /&gt;echo else if (name.equalsIgnoreCase("NWDEMSGTYPESEQ"))&lt;BR /&gt;{&lt;BR /&gt;setNWDEMSGTYPESEQ(strBuff);&lt;BR /&gt;}&lt;BR /&gt;echo else if (name.equalsIgnoreCase("NWDEMSGCTRYTIME"))&lt;BR /&gt;{&lt;BR /&gt;setNWDEMSGCTRYTIME(strBuff);&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;&lt;BR /&gt;Fred&lt;BR /&gt;&lt;/FD2&gt;&lt;/FD1&gt;</description>
      <pubDate>Fri, 30 Jul 2004 09:37:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/text-processing/m-p/3345544#M191569</guid>
      <dc:creator>Fred Ruffet</dc:creator>
      <dc:date>2004-07-30T09:37:14Z</dc:date>
    </item>
    <item>
      <title>Re: text processing</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/text-processing/m-p/3345545#M191570</link>
      <description>I have confused of multiple output's of set and setNWDEMSGTYPESEQ.&lt;BR /&gt;&lt;BR /&gt; It is as simple as,&lt;BR /&gt;&lt;BR /&gt;  awk '{ print "else if(name.equalsIgnoreCase(\""$0"))\n{\nsetNWDEMSGTYPESEQ(strBuff);" }' &lt;FILE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/FILE&gt;</description>
      <pubDate>Fri, 30 Jul 2004 09:54:34 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/text-processing/m-p/3345545#M191570</guid>
      <dc:creator>Muthukumar_5</dc:creator>
      <dc:date>2004-07-30T09:54:34Z</dc:date>
    </item>
    <item>
      <title>Re: text processing</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/text-processing/m-p/3345546#M191571</link>
      <description>I missed out } at the end,&lt;BR /&gt;&lt;BR /&gt; modified as,&lt;BR /&gt;&lt;BR /&gt; awk '{ print "else if(name.equalsIgnoreCase(\""$0"))\n{\nsetNWDEMSGTYPESEQ(strBuff);\n}" }' file1&lt;BR /&gt;&lt;BR /&gt;Output:&lt;BR /&gt;=======&lt;BR /&gt;else if(name.equalsIgnoreCase("NWDEMSGTYPESEQ))&lt;BR /&gt;{&lt;BR /&gt;setNWDEMSGTYPESEQ(strBuff);&lt;BR /&gt;}&lt;BR /&gt;else if(name.equalsIgnoreCase("NWDEMSGCTRYTIME))&lt;BR /&gt;{&lt;BR /&gt;setNWDEMSGTYPESEQ(strBuff);&lt;BR /&gt;}&lt;BR /&gt;</description>
      <pubDate>Fri, 30 Jul 2004 10:26:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/text-processing/m-p/3345546#M191571</guid>
      <dc:creator>Muthukumar_5</dc:creator>
      <dc:date>2004-07-30T10:26:09Z</dc:date>
    </item>
    <item>
      <title>Re: text processing</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/text-processing/m-p/3345547#M191572</link>
      <description>Output for my script is not good cause I put the same content in the 2 files. Try it anyway :)&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;&lt;BR /&gt;Fred&lt;BR /&gt;</description>
      <pubDate>Fri, 30 Jul 2004 11:06:02 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/text-processing/m-p/3345547#M191572</guid>
      <dc:creator>Fred Ruffet</dc:creator>
      <dc:date>2004-07-30T11:06:02Z</dc:date>
    </item>
    <item>
      <title>Re: text processing</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/text-processing/m-p/3345548#M191573</link>
      <description>Here is a one liner. By using "pr" to merge the 2 files and "perl" to reformat, I think this is what you are looking for-&lt;BR /&gt; &lt;BR /&gt;pr -mt file1 file2 | perl -n -e 'chomp; ($a,$b)=split "\\s+"; print "echo else if (name.equalsIgnoreCase(\"${b}\"))\n{\nset$&lt;BR /&gt;{a}(strBuff);\n}\n"'&lt;BR /&gt; &lt;BR /&gt;HTH&lt;BR /&gt; &lt;BR /&gt;-- Rod Hills&lt;BR /&gt;</description>
      <pubDate>Fri, 30 Jul 2004 11:34:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/text-processing/m-p/3345548#M191573</guid>
      <dc:creator>Rodney Hills</dc:creator>
      <dc:date>2004-07-30T11:34:07Z</dc:date>
    </item>
    <item>
      <title>Re: text processing</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/text-processing/m-p/3345549#M191574</link>
      <description>Another try with perl and sed as,&lt;BR /&gt;&lt;BR /&gt; Perl:&lt;BR /&gt; perl -p -e 's/[^.]/else if(name.equalsIgnoreCase(\"/;s/$/\"))\n{\nsetNWDEMSGTYPESEQ(strBuff);\n}/' file*&lt;BR /&gt;&lt;BR /&gt; To put the modified contents in the same file then,&lt;BR /&gt; perl -p -i -e 's/[^.]/else if(name.equalsIgnoreCase(\"/;s/$/\"))\n{\nsetNWDEMSGTYPESEQ(strBuff);\n}/' file*&lt;BR /&gt;&lt;BR /&gt; Using sed:&lt;BR /&gt;  sed -e 's/[^.]/else if(name.equalsIgnoreCase(\"/;s/$/\"))\&lt;BR /&gt;{\&lt;BR /&gt;setNWDEMSGTYPESEQ(strBuff);\&lt;BR /&gt;}/p' file*&lt;BR /&gt;&lt;BR /&gt;Regards&lt;BR /&gt;Muthu&lt;BR /&gt; &lt;BR /&gt;</description>
      <pubDate>Fri, 30 Jul 2004 12:38:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/text-processing/m-p/3345549#M191574</guid>
      <dc:creator>Muthukumar_5</dc:creator>
      <dc:date>2004-07-30T12:38:18Z</dc:date>
    </item>
    <item>
      <title>Re: text processing</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/text-processing/m-p/3345550#M191575</link>
      <description>&lt;BR /&gt;So you are trying to generate a long shell script driven by two list of words that are garantueed to remain in sync?&lt;BR /&gt;If the first file always a simple transformation of the second by removing all dashes? In that case I'd just use the second file with a 'one liner' like:&lt;BR /&gt;&lt;BR /&gt;perl -pe 'chomp;$x=$_;s/-//g;$y=$_;$_="echo else if name.equalsIgnoreCase(\"$x\")\n{\n\set$y(strBuff);\n}\n"' file_2&lt;BR /&gt;&lt;BR /&gt;(save word in x, remove dashes; save new word in y, create print buffer, let perl do the loop - read - print. )&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;If you need the two files, then I like the 'pr' solution as long as they remain in sync. If not you'll just need a doubel read loop. Some variation on the following awk 'one liner':&lt;BR /&gt;&lt;BR /&gt;awk '{getline y &amp;lt; "file_1";print "echo else if name.equalsIgnoreCase(\"" $1 "\")\n{\nset" y "(strBuff);\n}\n"}' file_2&lt;BR /&gt;&lt;BR /&gt;Cheers,&lt;BR /&gt;Hein.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Sun, 01 Aug 2004 20:31:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/text-processing/m-p/3345550#M191575</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2004-08-01T20:31:15Z</dc:date>
    </item>
  </channel>
</rss>

