Results 1 to 3 of 3
  1. #1
    Join Date
    Jun 2004
    Posts
    6

    Unanswered: Deleting a part of the line based on patterns

    Hi,

    I need to do something as below:

    george, john, mckay delete all here

    everything from delete should be deleted, the out put should be,

    george, john, mckay

    Any help appreciated.

    Thanks

  2. #2
    Join Date
    Apr 2004
    Location
    Boston, MA
    Posts
    325
    echo 'george, john, mckay delete all here' | sed -e 's/\(.*\) delete .*/\1/g'

  3. #3
    Join Date
    Jun 2004
    Posts
    6

    Thumbs up

    This works perfectly...I am too weak at shell script could you help me with another problem...

    I have a file like below:

    gina, crab.george, john, joe, crab.mckay

    Get rid of the 'crab.' and sort the rest of the output. I expect the output to be like:

    george, gina, joe, john, mckay

    Thanks for all your help.

Posting Permissions

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