<?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: Some vi help please ... in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/some-vi-help-please/m-p/2888688#M102455</link>
    <description>Thank you all for answering my question.&lt;BR /&gt;&lt;BR /&gt;Merijin, could you give me an example on how I would use the perl example but reference an actual file to print these lines from.  I can duplicate what you are doing, but where in the command would I actually reference my file to get these lines from?  I'm very new to perl.&lt;BR /&gt;&lt;BR /&gt;Andy</description>
    <pubDate>Thu, 23 Jan 2003 12:59:09 GMT</pubDate>
    <dc:creator>Andreas Mueller_1</dc:creator>
    <dc:date>2003-01-23T12:59:09Z</dc:date>
    <item>
      <title>Some vi help please ...</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/some-vi-help-please/m-p/2888683#M102450</link>
      <description>Let's say I have "originalscript" and want to "yank" lines 1 through 15 and put them in "newscript", here is what you do:&lt;BR /&gt;&lt;BR /&gt;vi +"1,15w! newscript|q" originalscript&lt;BR /&gt;&lt;BR /&gt;This works like a charm, but what if I now wanted to yank some more line from "originalscript" and write them to "newscript"?  Thus far it would overwrite newscript, not append like I would want it to.  Any ideas my great HP Masterguru Shell Progammers and Perl Magicians? Can I do a merge or something like that?&lt;BR /&gt;&lt;BR /&gt;Thank you, Andy</description>
      <pubDate>Wed, 22 Jan 2003 22:10:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/some-vi-help-please/m-p/2888683#M102450</guid>
      <dc:creator>Andreas Mueller_1</dc:creator>
      <dc:date>2003-01-22T22:10:30Z</dc:date>
    </item>
    <item>
      <title>Re: Some vi help please ...</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/some-vi-help-please/m-p/2888684#M102451</link>
      <description>Andy: it should be possible to use standard redirect and pipe notation to cause the new yanked lines to append to the existing target file.  I haven't tried it, and maybe it wouldn't work as straightforwardly as it seems.&lt;BR /&gt;&lt;BR /&gt;The alternative, of course, is to yank the later lines to a third file, and then simply cat the third file with an "append redirect" (&amp;gt;&amp;gt;) to the target file.  If desired, this could all happen in one command line, using semicolons to seperate command sequences.&lt;BR /&gt;&lt;BR /&gt;If you are doing this in a script, however, you could also use variables to hold the yanked lines or the file they went to, and then append them or manipulate them as desired.&lt;BR /&gt;&lt;BR /&gt;As in all UN*X stuff, there are a dozen ways to do anything, six of which are acceptable to most people, and a couple of which are optimal.  Maybe somebody else will suggest a more 'optimal' approach...&lt;BR /&gt;&lt;BR /&gt;Best Regards, and good luck with it.  --bmr</description>
      <pubDate>Wed, 22 Jan 2003 22:19:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/some-vi-help-please/m-p/2888684#M102451</guid>
      <dc:creator>Brian M Rawlings</dc:creator>
      <dc:date>2003-01-22T22:19:30Z</dc:date>
    </item>
    <item>
      <title>Re: Some vi help please ...</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/some-vi-help-please/m-p/2888685#M102452</link>
      <description>Andy,&lt;BR /&gt;&lt;BR /&gt;With "vi" you can change do&lt;BR /&gt;&lt;BR /&gt;vi +"20,25w &amp;gt;&amp;gt; newscript|q" originalscript&lt;BR /&gt;&lt;BR /&gt;The "&amp;gt;&amp;gt;" will do an "append" write.&lt;BR /&gt;&lt;BR /&gt;A better tool might be sed-&lt;BR /&gt;&lt;BR /&gt;sed -n '1,15p;20,25p' &lt;ORIGINALSCRIPT&gt;&lt;/ORIGINALSCRIPT&gt;&lt;BR /&gt;HTH&lt;BR /&gt;&lt;BR /&gt;-- Rod Hills</description>
      <pubDate>Wed, 22 Jan 2003 22:25:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/some-vi-help-please/m-p/2888685#M102452</guid>
      <dc:creator>Rodney Hills</dc:creator>
      <dc:date>2003-01-22T22:25:51Z</dc:date>
    </item>
    <item>
      <title>Re: Some vi help please ...</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/some-vi-help-please/m-p/2888686#M102453</link>
      <description>Vi is not really the tool for this. Vi is an interactive, screen-based editor, but you are doing batch type edits.&lt;BR /&gt;You should look at sed, or awk, or perl, or ...&lt;BR /&gt;&lt;BR /&gt;My preference is awk. To copy lines 15 through 30 inclusive from file1 and append to file2, something like:&lt;BR /&gt;&lt;BR /&gt;cat file1|awk '(NR &amp;gt;=15 &amp;amp;&amp;amp; NR &amp;lt;=30) {print} ' &amp;gt;&amp;gt; file2&lt;BR /&gt;&lt;BR /&gt;- Graham</description>
      <pubDate>Thu, 23 Jan 2003 08:18:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/some-vi-help-please/m-p/2888686#M102453</guid>
      <dc:creator>Graham Cameron_1</dc:creator>
      <dc:date>2003-01-23T08:18:19Z</dc:date>
    </item>
    <item>
      <title>Re: Some vi help please ...</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/some-vi-help-please/m-p/2888687#M102454</link>
      <description>perl, I saw perl.&lt;BR /&gt;&lt;BR /&gt;It's about the second perl call, the first is only to generate a list to prove it works:&lt;BR /&gt;&lt;BR /&gt;a5:/u/usr/merijn 102 &amp;gt; perl -le 'print for 1..10'&lt;BR /&gt;1&lt;BR /&gt;2&lt;BR /&gt;3&lt;BR /&gt;4&lt;BR /&gt;5&lt;BR /&gt;6&lt;BR /&gt;7&lt;BR /&gt;8&lt;BR /&gt;9&lt;BR /&gt;10&lt;BR /&gt;a5:/u/usr/merijn 103 &amp;gt; perl -le 'print for 1..60' | perl -ne'(10..15 or 20..22 or 30..32)and print'&lt;BR /&gt;10&lt;BR /&gt;11&lt;BR /&gt;12&lt;BR /&gt;13&lt;BR /&gt;14&lt;BR /&gt;15&lt;BR /&gt;20&lt;BR /&gt;21&lt;BR /&gt;22&lt;BR /&gt;30&lt;BR /&gt;31&lt;BR /&gt;32&lt;BR /&gt;a5:/u/usr/merijn 104 &amp;gt;&lt;BR /&gt;&lt;BR /&gt;Enjoy, have FUN! H.Merijn</description>
      <pubDate>Thu, 23 Jan 2003 08:19:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/some-vi-help-please/m-p/2888687#M102454</guid>
      <dc:creator>H.Merijn Brand (procura</dc:creator>
      <dc:date>2003-01-23T08:19:38Z</dc:date>
    </item>
    <item>
      <title>Re: Some vi help please ...</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/some-vi-help-please/m-p/2888688#M102455</link>
      <description>Thank you all for answering my question.&lt;BR /&gt;&lt;BR /&gt;Merijin, could you give me an example on how I would use the perl example but reference an actual file to print these lines from.  I can duplicate what you are doing, but where in the command would I actually reference my file to get these lines from?  I'm very new to perl.&lt;BR /&gt;&lt;BR /&gt;Andy</description>
      <pubDate>Thu, 23 Jan 2003 12:59:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/some-vi-help-please/m-p/2888688#M102455</guid>
      <dc:creator>Andreas Mueller_1</dc:creator>
      <dc:date>2003-01-23T12:59:09Z</dc:date>
    </item>
    <item>
      <title>Re: Some vi help please ...</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/some-vi-help-please/m-p/2888689#M102456</link>
      <description>Funny how mij name sometimes gets misspelled so that I cannot pronounce it myself anymore :) [ No pun intended ] I guess that the wizards are duelling again and expelleriamus is casted to us instead.&lt;BR /&gt;&lt;BR /&gt;a5:/u/usr/merijn 103 &amp;gt; perl -ne'(10..15 or 20..22 or 30..32)and print' your_file&lt;BR /&gt;&lt;BR /&gt;note that since this not so widely known feature uses line ranges, you have to make a single line a range too (e.g. 14..14)&lt;BR /&gt;&lt;BR /&gt;Enjoy, have FUN! H.Merijn</description>
      <pubDate>Thu, 23 Jan 2003 16:16:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/some-vi-help-please/m-p/2888689#M102456</guid>
      <dc:creator>H.Merijn Brand (procura</dc:creator>
      <dc:date>2003-01-23T16:16:43Z</dc:date>
    </item>
  </channel>
</rss>

