<?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: Small help in shell script in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/small-help-in-shell-script/m-p/3303409#M184191</link>
    <description>I like the perl, how about this as an alternative&lt;BR /&gt;# awk '{printf "%s\n%s\n", $0, $0}' A &amp;gt; AA&lt;BR /&gt;# paste AA B&lt;BR /&gt;&lt;BR /&gt;Tim</description>
    <pubDate>Sat, 12 Jun 2004 12:23:42 GMT</pubDate>
    <dc:creator>Tim D Fulford</dc:creator>
    <dc:date>2004-06-12T12:23:42Z</dc:date>
    <item>
      <title>Small help in shell script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/small-help-in-shell-script/m-p/3303406#M184188</link>
      <description>Hi folks,&lt;BR /&gt;&lt;BR /&gt;   I have 2 files..lets take A and B&lt;BR /&gt;I want a shell script such that, it must read first line from file "A" and 2 line from "B". This must repeat for whole file a.&lt;BR /&gt;&lt;BR /&gt;I think you are confused..Let me explain with an example...&lt;BR /&gt;&lt;BR /&gt;"A" file containes &lt;BR /&gt;      1&lt;BR /&gt;      2&lt;BR /&gt;      3&lt;BR /&gt;and "B" file containes&lt;BR /&gt;      aaa&lt;BR /&gt;      bbb&lt;BR /&gt;      ccc&lt;BR /&gt;      ddd&lt;BR /&gt;      eee&lt;BR /&gt;      fff&lt;BR /&gt;      ggg&lt;BR /&gt;      hhh&lt;BR /&gt;now i want output like&lt;BR /&gt;&lt;BR /&gt;1 aaa&lt;BR /&gt;1 bbb&lt;BR /&gt;2 ccc&lt;BR /&gt;2 ddd&lt;BR /&gt;3 eee&lt;BR /&gt;3 fff&lt;BR /&gt;4 ggg&lt;BR /&gt;4 hhh&lt;BR /&gt;      &lt;BR /&gt;&lt;BR /&gt;This is very importaant and urgent...Please friends help me fast...&lt;BR /&gt;&lt;BR /&gt;Thnks in advance&lt;BR /&gt;&lt;BR /&gt;***** Problem is a problem untill U feel that is a Problem****&lt;BR /&gt;</description>
      <pubDate>Sat, 12 Jun 2004 11:40:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/small-help-in-shell-script/m-p/3303406#M184188</guid>
      <dc:creator>Sreekanth Makam</dc:creator>
      <dc:date>2004-06-12T11:40:35Z</dc:date>
    </item>
    <item>
      <title>Re: Small help in shell script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/small-help-in-shell-script/m-p/3303407#M184189</link>
      <description>does it have to be a *sh* script?&lt;BR /&gt;&lt;BR /&gt;# perl -le'$b=pop;@a=&amp;lt;&amp;gt;;@ARGV=($b);@b=&amp;lt;&amp;gt;;for(@a){print$_,splice@,0,3}' fileA fileB&lt;BR /&gt;&lt;BR /&gt;will do it. No error checks on fileb having at least 3 times the lines fileA has&lt;BR /&gt;&lt;BR /&gt;There are several variants to this of course. Above looked the shortest&lt;BR /&gt;&lt;BR /&gt;Enjoy, Have FUN! H.Merijn</description>
      <pubDate>Sat, 12 Jun 2004 12:09:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/small-help-in-shell-script/m-p/3303407#M184189</guid>
      <dc:creator>H.Merijn Brand (procura</dc:creator>
      <dc:date>2004-06-12T12:09:03Z</dc:date>
    </item>
    <item>
      <title>Re: Small help in shell script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/small-help-in-shell-script/m-p/3303408#M184190</link>
      <description>cat fileB |&amp;amp;&lt;BR /&gt;&lt;BR /&gt;cat fileA |&lt;BR /&gt;while read varA&lt;BR /&gt;do&lt;BR /&gt;read -p varB&lt;BR /&gt;print "$varA $varB"&lt;BR /&gt;read -p varB&lt;BR /&gt;print "$varA $varB"&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;of course there is no error checking that the files will have matching entries, etc.&lt;BR /&gt;</description>
      <pubDate>Sat, 12 Jun 2004 12:22:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/small-help-in-shell-script/m-p/3303408#M184190</guid>
      <dc:creator>curt larson_1</dc:creator>
      <dc:date>2004-06-12T12:22:31Z</dc:date>
    </item>
    <item>
      <title>Re: Small help in shell script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/small-help-in-shell-script/m-p/3303409#M184191</link>
      <description>I like the perl, how about this as an alternative&lt;BR /&gt;# awk '{printf "%s\n%s\n", $0, $0}' A &amp;gt; AA&lt;BR /&gt;# paste AA B&lt;BR /&gt;&lt;BR /&gt;Tim</description>
      <pubDate>Sat, 12 Jun 2004 12:23:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/small-help-in-shell-script/m-p/3303409#M184191</guid>
      <dc:creator>Tim D Fulford</dc:creator>
      <dc:date>2004-06-12T12:23:42Z</dc:date>
    </item>
    <item>
      <title>Re: Small help in shell script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/small-help-in-shell-script/m-p/3303410#M184192</link>
      <description>And I misread the post just a bit. Here's a modified snippet&lt;BR /&gt;&lt;BR /&gt;# perl -e'$b=pop;chomp(@a=&amp;lt;&amp;gt;);@ARGV=($b);@b=&amp;lt;&amp;gt;;for$a(@a){print"$a $_"for splice@b,0,3}' fileA fileB&lt;BR /&gt;&lt;BR /&gt;Lets test ...&lt;BR /&gt;&lt;BR /&gt;lt09:/home/merijn 126 &amp;gt; perl -e'$b=pop;chomp(@a=&amp;lt;&amp;gt;);@ARGV=($b);@b=&amp;lt;&amp;gt;;for$a(@a){print"$a $_"for splice@b,0,3}' fileA fileB&lt;BR /&gt;1 aaa&lt;BR /&gt;1 bbb&lt;BR /&gt;1 ccc&lt;BR /&gt;2 ddd&lt;BR /&gt;2 eee&lt;BR /&gt;2 fff&lt;BR /&gt;3 ggg&lt;BR /&gt;3 hhh&lt;BR /&gt;lt09:/home/merijn 127 &amp;gt;&lt;BR /&gt;&lt;BR /&gt;Sorry if that caused confusion&lt;BR /&gt;Enjoy, Have FUN! H.Merijn</description>
      <pubDate>Sat, 12 Jun 2004 12:36:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/small-help-in-shell-script/m-p/3303410#M184192</guid>
      <dc:creator>H.Merijn Brand (procura</dc:creator>
      <dc:date>2004-06-12T12:36:00Z</dc:date>
    </item>
    <item>
      <title>Re: Small help in shell script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/small-help-in-shell-script/m-p/3303411#M184193</link>
      <description>procura...&lt;BR /&gt;&lt;BR /&gt;I get the following eror for:&lt;BR /&gt;# perl -le '$b=pop;@a=&amp;lt;&amp;gt;;@ARGV=($b);@b=&amp;lt;&amp;gt;;for(@a){print $_,splice @,0,3}' A B&lt;BR /&gt;Number found where operator expected at -e line 1, near "@,0"&lt;BR /&gt;        (Missing operator before 0?)&lt;BR /&gt;syntax error at -e line 1, near "@,0"&lt;BR /&gt;Execution of -e aborted due to compilation errors.&lt;BR /&gt;&lt;BR /&gt;Tim</description>
      <pubDate>Sat, 12 Jun 2004 12:36:29 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/small-help-in-shell-script/m-p/3303411#M184193</guid>
      <dc:creator>Tim D Fulford</dc:creator>
      <dc:date>2004-06-12T12:36:29Z</dc:date>
    </item>
    <item>
      <title>Re: Small help in shell script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/small-help-in-shell-script/m-p/3303412#M184194</link>
      <description>repaired in last post. (And checked this time)&lt;BR /&gt;&lt;BR /&gt;Enjoy, Have FUN!H.Merijn</description>
      <pubDate>Sat, 12 Jun 2004 12:44:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/small-help-in-shell-script/m-p/3303412#M184194</guid>
      <dc:creator>H.Merijn Brand (procura</dc:creator>
      <dc:date>2004-06-12T12:44:14Z</dc:date>
    </item>
    <item>
      <title>Re: Small help in shell script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/small-help-in-shell-script/m-p/3303413#M184195</link>
      <description>I think procura deserves a ..10.. BUT the code is still wrong (see question, it asks repeat two lines from A for each line of B not 3...) that said, it is trivial to fix..&lt;BR /&gt;&lt;BR /&gt;# perl -e'$b=pop;chomp(@a=&amp;lt;&amp;gt;);@ARGV=($b);@b=&amp;lt;&amp;gt;;for$a(@a){print"$a $_"for splice@b,&lt;BR /&gt;0,2}' A B&lt;BR /&gt;&lt;BR /&gt;did the trick for me.. excellent much neater than my "awk &amp;amp; paste"&lt;BR /&gt;&lt;BR /&gt;Tim</description>
      <pubDate>Sat, 12 Jun 2004 17:08:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/small-help-in-shell-script/m-p/3303413#M184195</guid>
      <dc:creator>Tim D Fulford</dc:creator>
      <dc:date>2004-06-12T17:08:24Z</dc:date>
    </item>
    <item>
      <title>Re: Small help in shell script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/small-help-in-shell-script/m-p/3303414#M184196</link>
      <description>Hi curt,&lt;BR /&gt;&lt;BR /&gt;  It helped me a lot.. Thnks ....&lt;BR /&gt;&lt;BR /&gt;Thnks for others also..But I don't know perl. But after seeing your answers..I feel perl is better and faster.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;***** Problem is a problem untill U feel that is a Problem****</description>
      <pubDate>Sun, 13 Jun 2004 02:28:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/small-help-in-shell-script/m-p/3303414#M184196</guid>
      <dc:creator>Sreekanth Makam</dc:creator>
      <dc:date>2004-06-13T02:28:51Z</dc:date>
    </item>
    <item>
      <title>Re: Small help in shell script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/small-help-in-shell-script/m-p/3303415#M184197</link>
      <description>`better' is not very objective for scripts. There is a good language for every solution in unix, and it's not always Perl.&lt;BR /&gt;&lt;BR /&gt;The more you are familiar with /any/ language, the more you will use it, and the faster it will bring you to the desired results.&lt;BR /&gt;&lt;BR /&gt;I know people that wrote 2000 line sys-admin scripts in csh. I bet that there are more people on this forum that shivver to maintain that than there are people that shivver to decrypt one of my perl one-liners :)&lt;BR /&gt;&lt;BR /&gt;I know perl, because I use it for almost everything, but until you are familiar with it, awk, sed, sh, sort, and comm are proably better utilt for you than Perl. Even if the given solution is faster and/or `better'.&lt;BR /&gt;&lt;BR /&gt;I was tired yesterday, obviously. the typo (missing 'b') in my first post is due to my keyboard, that often needs a harder hit for the 'b' key, but the misreading of your post, and the second misreading of 3 instead of two is simply sloppy and careless.&lt;BR /&gt;&lt;BR /&gt;Perl is a fine language for scripting, because it is so versatile, and has all the needed glue elements built-in. I can understand people not using it for bigger projects due to the sometimes obfuscated constructs, but IMHO there also lies the grace of it. Perl is much more powerful and versatile than Python for example, but in larger development groups, I can imagine that the group benefits from the restrictive formats and structures of Python.&lt;BR /&gt;&lt;BR /&gt;I, for example, never use posix-sh features, but restrict myself, when programming sh, to the very old bourne shell set just because of (backward) compatibility.&lt;BR /&gt;&lt;BR /&gt;Enjoy (scripting), Have FUN! H.Merijn [ always there to promote Perl ]</description>
      <pubDate>Sun, 13 Jun 2004 03:38:34 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/small-help-in-shell-script/m-p/3303415#M184197</guid>
      <dc:creator>H.Merijn Brand (procura</dc:creator>
      <dc:date>2004-06-13T03:38:34Z</dc:date>
    </item>
    <item>
      <title>Re: Small help in shell script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/small-help-in-shell-script/m-p/3303416#M184198</link>
      <description>Hai.&lt;BR /&gt;&lt;BR /&gt; Attached script will do the requirement. But b file has to contain twice the lines as in a file. If you don't want to check this remove the checking loop in script.&lt;BR /&gt;&lt;BR /&gt; Give the input files and result file,you will get the required results on result file.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Muthukumar. &lt;BR /&gt;</description>
      <pubDate>Mon, 14 Jun 2004 06:37:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/small-help-in-shell-script/m-p/3303416#M184198</guid>
      <dc:creator>Muthukumar_5</dc:creator>
      <dc:date>2004-06-14T06:37:58Z</dc:date>
    </item>
    <item>
      <title>Re: Small help in shell script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/small-help-in-shell-script/m-p/3303417#M184199</link>
      <description>Hello muthukumar,&lt;BR /&gt;&lt;BR /&gt;U wrote a really big program..Sorry yaar..I did'nt like it..Shell scrip must me sweet and short..&lt;BR /&gt;&lt;BR /&gt;Any way thnks for your replay...&lt;BR /&gt;</description>
      <pubDate>Mon, 14 Jun 2004 07:26:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/small-help-in-shell-script/m-p/3303417#M184199</guid>
      <dc:creator>Sreekanth Makam</dc:creator>
      <dc:date>2004-06-14T07:26:21Z</dc:date>
    </item>
    <item>
      <title>Re: Small help in shell script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/small-help-in-shell-script/m-p/3303418#M184200</link>
      <description>For your reference: &lt;A href="http://developers.slashdot.org/article.pl?sid=04/06/12/2125229" target="_blank"&gt;http://developers.slashdot.org/article.pl?sid=04/06/12/2125229&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Enjoy, Have FUN! H.Merijn</description>
      <pubDate>Mon, 14 Jun 2004 07:51:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/small-help-in-shell-script/m-p/3303418#M184200</guid>
      <dc:creator>H.Merijn Brand (procura</dc:creator>
      <dc:date>2004-06-14T07:51:31Z</dc:date>
    </item>
  </channel>
</rss>

