<?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 Deleting lines from a script. in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/deleting-lines-from-a-script/m-p/4035068#M93908</link>
    <description>If I want to delete the first and the last line of text how could I do it. I would really appreciated. Your help is greatly appreciated. Below is the first line that I would like to delete that gets generated from the script listed here rebuild_inx.sh, and creates this file rebuild_inx.sql. So, once this file rebuild_inx.sql is created I would like to eliminate the text lines that gets generated as the regular script. I hope you understand what I am trying to say.&lt;BR /&gt;&lt;BR /&gt;SQL&amp;gt; select ' ALTER INDEX '|| index_name || ' REBUILD PARALLEL 4 NOLOGGING ONLIN&lt;BR /&gt;E ;' FROM USER_INDEXES WHERE TABLE_OWNER LIKE 'SYSADM';&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Here is the regular script that runs. Please check below.&lt;BR /&gt;&lt;BR /&gt;rebuild_inx.sh&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;# Rebuild All Indexes&lt;BR /&gt;export ORACLE_SID=CRM89DMO&lt;BR /&gt;sqlplus sysadm/desk911@CRM89DMO &amp;lt;&lt;EOF1&gt;&lt;/EOF1&gt;set echo off pagesize 0 feedback off verity off heading off&lt;BR /&gt;spool rebuild_inx.sql&lt;BR /&gt;select ' ALTER INDEX '|| index_name || ' REBUILD PARALLEL 4 NOLOGGING ONLINE ;'&lt;BR /&gt;FROM USER_INDEXES WHERE TABLE_OWNER LIKE 'SYSADM';&lt;BR /&gt;spool off;&lt;BR /&gt;exit&lt;BR /&gt;EOF1&lt;BR /&gt;</description>
    <pubDate>Tue, 10 Jul 2007 11:31:00 GMT</pubDate>
    <dc:creator>Reynaldo Torres</dc:creator>
    <dc:date>2007-07-10T11:31:00Z</dc:date>
    <item>
      <title>Deleting lines from a script.</title>
      <link>https://community.hpe.com/t5/operating-system-linux/deleting-lines-from-a-script/m-p/4035068#M93908</link>
      <description>If I want to delete the first and the last line of text how could I do it. I would really appreciated. Your help is greatly appreciated. Below is the first line that I would like to delete that gets generated from the script listed here rebuild_inx.sh, and creates this file rebuild_inx.sql. So, once this file rebuild_inx.sql is created I would like to eliminate the text lines that gets generated as the regular script. I hope you understand what I am trying to say.&lt;BR /&gt;&lt;BR /&gt;SQL&amp;gt; select ' ALTER INDEX '|| index_name || ' REBUILD PARALLEL 4 NOLOGGING ONLIN&lt;BR /&gt;E ;' FROM USER_INDEXES WHERE TABLE_OWNER LIKE 'SYSADM';&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Here is the regular script that runs. Please check below.&lt;BR /&gt;&lt;BR /&gt;rebuild_inx.sh&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;# Rebuild All Indexes&lt;BR /&gt;export ORACLE_SID=CRM89DMO&lt;BR /&gt;sqlplus sysadm/desk911@CRM89DMO &amp;lt;&lt;EOF1&gt;&lt;/EOF1&gt;set echo off pagesize 0 feedback off verity off heading off&lt;BR /&gt;spool rebuild_inx.sql&lt;BR /&gt;select ' ALTER INDEX '|| index_name || ' REBUILD PARALLEL 4 NOLOGGING ONLINE ;'&lt;BR /&gt;FROM USER_INDEXES WHERE TABLE_OWNER LIKE 'SYSADM';&lt;BR /&gt;spool off;&lt;BR /&gt;exit&lt;BR /&gt;EOF1&lt;BR /&gt;</description>
      <pubDate>Tue, 10 Jul 2007 11:31:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/deleting-lines-from-a-script/m-p/4035068#M93908</guid>
      <dc:creator>Reynaldo Torres</dc:creator>
      <dc:date>2007-07-10T11:31:00Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting lines from a script.</title>
      <link>https://community.hpe.com/t5/operating-system-linux/deleting-lines-from-a-script/m-p/4035069#M93909</link>
      <description>From "Handy One-Liners for Sed" (attached):&lt;BR /&gt;&lt;BR /&gt;# print all but first line of file&lt;BR /&gt; sed 1d infile &amp;gt;&amp;gt; outfile&lt;BR /&gt;&lt;BR /&gt;# print last line of file (emulates "tail -1")&lt;BR /&gt; sed '$!d'&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Pete</description>
      <pubDate>Tue, 10 Jul 2007 11:37:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/deleting-lines-from-a-script/m-p/4035069#M93909</guid>
      <dc:creator>Pete Randall</dc:creator>
      <dc:date>2007-07-10T11:37:16Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting lines from a script.</title>
      <link>https://community.hpe.com/t5/operating-system-linux/deleting-lines-from-a-script/m-p/4035070#M93910</link>
      <description>Hi Reynaldo:&lt;BR /&gt;&lt;BR /&gt;A general solution to deleting the first and the last line of a file is this:&lt;BR /&gt;&lt;BR /&gt;# perl -ne 'next if $.==1;next if eof;print' file&lt;BR /&gt;&lt;BR /&gt;If you wish to perform an inplace update, do:&lt;BR /&gt;&lt;BR /&gt;# perl -ni -e 'next if $.==1;next if eof;print' file&lt;BR /&gt;&lt;BR /&gt;To preserve a backup copy of the file before modification, as "*.old" do:&lt;BR /&gt;&lt;BR /&gt;# perl -ni.old -e ...&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Tue, 10 Jul 2007 11:44:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/deleting-lines-from-a-script/m-p/4035070#M93910</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2007-07-10T11:44:44Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting lines from a script.</title>
      <link>https://community.hpe.com/t5/operating-system-linux/deleting-lines-from-a-script/m-p/4035071#M93911</link>
      <description>Hi (again):&lt;BR /&gt;&lt;BR /&gt;The 'sed' solution can be combined into one-pass:&lt;BR /&gt;&lt;BR /&gt;# sed -n '1d;$d;p' file&lt;BR /&gt;&lt;BR /&gt;The Perl script can be altered slightly (as below) to process any number of files:&lt;BR /&gt;&lt;BR /&gt;# perl -ne 'next if $.==1;close ARGV,next if eof;print' file1 file2 file3 ...&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Tue, 10 Jul 2007 13:04:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/deleting-lines-from-a-script/m-p/4035071#M93911</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2007-07-10T13:04:00Z</dc:date>
    </item>
  </channel>
</rss>

