[HPADM] SUMMARY: Remove the first "N" lines of a file to "string" with " sed" ?

From: Abramson, Stuart (SAbramson@Wabtec.com)
Date: Thu Dec 11 2003 - 14:51:06 EST


hpux-admins:
 
Thanks to:
 
    Sundararajan Swaminathan
    Hunter Edison
    Steve Sandau
    Bill Thompson
    David Totsch
    Kevin Davisson
    Jon Fife
    Denny Koovakattu
    Tony Kruse
    Allan Marillier
    more...
 
First correct answer below.
 
    Stuart

  _____

From: Swaminathan, Sundararajan {Orac~Palo Alto}
[mailto:sundararajan.swaminathan@ROCHE.COM]
Sent: Thursday, December 11, 2003 12:34 PM
To: Abramson, Stuart
Subject: RE: [HPADM] RE: Remove "N" lines of a file with "sed" ?

Hi Stuart,
 
    How about this
 
    # sed -n '/^STARTUP/,//p' < input > output
 
 
Thanks,
 
Sundar.

-----Original Message-----
From: hpux-admin-owner@DutchWorks.nl [mailto:hpux-admin-owner@DutchWorks.nl]
On Behalf Of Abramson, Stuart
Sent: Thursday, December 11, 2003 9:23 AM
To: Hpux-Admin (hpux-admin@dutchworks.nl)
Subject: [HPADM] RE: Remove "N" lines of a file with "sed" ?

hpux-admins:
 
I can't count lines. I don't know how many there will be, and the number
could change. I have to key on the fact that the first line I want to keep
is the
"STARTUP" line.
 
    Stuart

  _____

From: Nikiforuk, Kevin [mailto:knikifor@epcor.ca]
Sent: Thursday, December 11, 2003 12:16 PM
To: Abramson, Stuart
Subject: RE: [HPADM] Remove "N" lines of a file with "sed" ?

tail -n +N filename > filename.new
cp filename.new filename

        -----Original Message-----
From: hpux-admin-owner@DutchWorks.nl [SMTP:hpux-admin-owner@DutchWorks.nl]
On Behalf Of Abramson, Stuart
Sent: Thursday, December 11, 2003 10:09 AM
To: Hpux-Admin (hpux-admin@dutchworks.nl)
Subject: [HPADM] Remove "N" lines of a file with "sed" ?

        Below are the first "N" lines of an Oracle database control file.

        I want to delete the first "N" lines, from the beginning of the file
down to the 2nd "***" line, and copy the rest of the file to a new file.

        I have to do it in a batch job. I would normally do these kinds of
things with sed, but I can't quite figure out how.

        How do I do that?

                Stuart
-----------------------------------------------

        /u1001/app/oracle/admin/HOTB/udump/ora_4073_hotb.trc
Oracle8i Enterprise Edition Release 8.1.7.4.0 - Production
With the Partitioning option
JServer Release 8.1.7.4.0 - Production
ORACLE_HOME = /u1001/app/oracle/product/8.1.7
System name: HP-UX
Node name: wcshps07
Release: B.11.11
Version: U
Machine: 9000/800
Instance name: HOTB
Redo thread mounted by this instance: 1
Oracle process number: 15
Unix process pid: 4073, image: oracle@wcshps07 (TNS V1-V3)

        *** SESSION ID:(10.1971) 2003-12-11 12:00:18.278
*** 2003-12-11 12:00:18.278
STARTUP NOMOUNT
CREATE CONTROLFILE REUSE DATABASE "HOTB" NORESETLOGS ARCHIVELOG
    MAXLOGFILES 16
    MAXLOGMEMBERS 2
    MAXDATAFILES 30
    MAXINSTANCES 1
Stuart Abramson | Off: 412/825-1434 | Cell: 412/417-1567 | email:
sabramson@wabtec.com

        ***** CONFIDENTIALITY NOTE *****
The content contained in this e-mail transmission is legally privileged and
confidential information intended only for the use of the individual or
entity named herein. If the reader of this transmission is not the intended
recipient, you are hereby notified that any dissemination, distribution, or
copying of this transmission is strictly prohibited.

***** CONFIDENTIALITY NOTE *****
The content contained in this e-mail transmission is legally privileged and
confidential information intended only for the use of the individual or
entity named herein. If the reader of this transmission is not the intended
recipient, you are hereby notified that any dissemination, distribution, or
copying of this transmission is strictly prohibited.

***** CONFIDENTIALITY NOTE *****
The content contained in this e-mail transmission is legally privileged and confidential information intended only for the use of the individual or entity named herein. If the reader of this transmission is not the intended recipient, you are hereby notified that any dissemination, distribution, or copying of this transmission is strictly prohibited.

--
             ---> Please post QUESTIONS and SUMMARIES only!! <---
        To subscribe/unsubscribe to this list, contact majordomo@dutchworks.nl
       Name: hpux-admin@dutchworks.nl     Owner: owner-hpux-admin@dutchworks.nl
 
 Archives:  ftp.dutchworks.nl:/pub/digests/hpux-admin       (FTP, browse only)
            http://www.dutchworks.nl/htbin/hpsysadmin   (Web, browse & search)


This archive was generated by hypermail 2.1.7 : Sat Apr 12 2008 - 11:02:37 EDT