- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Re: Deleting lines from a script.
Operating System - Linux
1752631
Members
5709
Online
108788
Solutions
Forums
Categories
Company
Local Language
юдл
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
юдл
back
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Go to solution
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-10-2007 04:31 AM
тАО07-10-2007 04:31 AM
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.
SQL> select ' ALTER INDEX '|| index_name || ' REBUILD PARALLEL 4 NOLOGGING ONLIN
E ;' FROM USER_INDEXES WHERE TABLE_OWNER LIKE 'SYSADM';
Here is the regular script that runs. Please check below.
rebuild_inx.sh
#!/usr/bin/sh
# Rebuild All Indexes
export ORACLE_SID=CRM89DMO
sqlplus sysadm/desk911@CRM89DMO < set echo off pagesize 0 feedback off verity off heading off
spool rebuild_inx.sql
select ' ALTER INDEX '|| index_name || ' REBUILD PARALLEL 4 NOLOGGING ONLINE ;'
FROM USER_INDEXES WHERE TABLE_OWNER LIKE 'SYSADM';
spool off;
exit
EOF1
SQL> select ' ALTER INDEX '|| index_name || ' REBUILD PARALLEL 4 NOLOGGING ONLIN
E ;' FROM USER_INDEXES WHERE TABLE_OWNER LIKE 'SYSADM';
Here is the regular script that runs. Please check below.
rebuild_inx.sh
#!/usr/bin/sh
# Rebuild All Indexes
export ORACLE_SID=CRM89DMO
sqlplus sysadm/desk911@CRM89DMO <
spool rebuild_inx.sql
select ' ALTER INDEX '|| index_name || ' REBUILD PARALLEL 4 NOLOGGING ONLINE ;'
FROM USER_INDEXES WHERE TABLE_OWNER LIKE 'SYSADM';
spool off;
exit
EOF1
Reynaldo Torres
Solved! Go to Solution.
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-10-2007 04:37 AM
- Tags:
- sed
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-10-2007 04:44 AM
тАО07-10-2007 04:44 AM
Re: Deleting lines from a script.
Hi Reynaldo:
A general solution to deleting the first and the last line of a file is this:
# perl -ne 'next if $.==1;next if eof;print' file
If you wish to perform an inplace update, do:
# perl -ni -e 'next if $.==1;next if eof;print' file
To preserve a backup copy of the file before modification, as "*.old" do:
# perl -ni.old -e ...
Regards!
...JRF...
A general solution to deleting the first and the last line of a file is this:
# perl -ne 'next if $.==1;next if eof;print' file
If you wish to perform an inplace update, do:
# perl -ni -e 'next if $.==1;next if eof;print' file
To preserve a backup copy of the file before modification, as "*.old" do:
# perl -ni.old -e ...
Regards!
...JRF...
- Tags:
- Perl
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-10-2007 06:04 AM
тАО07-10-2007 06:04 AM
Re: Deleting lines from a script.
Hi (again):
The 'sed' solution can be combined into one-pass:
# sed -n '1d;$d;p' file
The Perl script can be altered slightly (as below) to process any number of files:
# perl -ne 'next if $.==1;close ARGV,next if eof;print' file1 file2 file3 ...
Regards!
...JRF...
The 'sed' solution can be combined into one-pass:
# sed -n '1d;$d;p' file
The Perl script can be altered slightly (as below) to process any number of files:
# perl -ne 'next if $.==1;close ARGV,next if eof;print' file1 file2 file3 ...
Regards!
...JRF...
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
News and Events
Support
© Copyright 2024 Hewlett Packard Enterprise Development LP