#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2004
    Posts
    2
    Rep Power
    0

    Need Help With SED!


    I'd like to use SED to search for a string, print the line where the string was found, plus print the next 5 lines after the string. Can anyone help??? Thanks.
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    Jul 2004
    Location
    Middle Europa
    Posts
    1,198
    Rep Power
    17
    sed -n '/stringtoprint/{ p; n; p; n; p; n; p; n; p; n; p;}' inputfile >outputfile
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2004
    Posts
    2
    Rep Power
    0

    Thanks guggach | works great!


    Thanks for your help!

IMN logo majestic logo threadwatch logo seochat tools logo