Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2004
    Posts
    1

    Unanswered: Deleting a line from a file

    Hi - i am a beginner in unix. Is there a way to delete a line from a file. For example i want to delete a line which has the the word john in it
    Thanks

  2. #2
    Join Date
    Apr 2004
    Location
    Boston, MA
    Posts
    325
    http://www.pement.org/sed/sed1line.txt

    # print only lines which do NOT match regexp (emulates "grep -v")
    sed -n '/regexp/!p' # method 1, corresponds to above
    sed '/regexp/d' # method 2, simpler syntax
    vlad
    +-----------------------+
    | #include <disclaimer.h> |
    +-----------------------+

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •