#1
  1. cave painting, the 1st Opn Src
    Devshed Novice (500 - 999 posts)

    Join Date
    Jun 2003
    Posts
    532
    Rep Power
    0

    Sed del but need last line


    I have a this:
    Code:
    sed '/CT#/,/DESCRIPTION/d' TASK.03 > nuTASK.03
    Which is fine for removing all the info, but I need the DESCRIPTION line and it is removing that line since it is my END key word.
    It is the only common term I can use to remove this vary sized section.

    How do I del with pattern range but Keep the END line?

    example:

    PT# 1000
    CT# 200
    word
    word
    word
    DESCRIPTION
    DESC
    DESC

    run cmd I get

    PT# 1000
    DESC
    DESC

    and I need

    PT# 1000
    DESCRIPTION
    DESC
    DESC
    Last edited by dba_frog; January 25th, 2011 at 09:18 AM.
    Curious by Nature,
    Linux by Choice
    Lawson ERP reference tools: Lawsuss.com
  2. #2
  3. Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Sep 2006
    Posts
    859
    Rep Power
    388

    Talking


    Try this:

    PHP Code:
    awk '/CT#/{sw=1}/DESCRIPTION/{sw=0} sw == 0 {print}' TASK.03 nuTASK.03 

IMN logo majestic logo threadwatch logo seochat tools logo