Find the answer to your Linux question:
Results 1 to 3 of 3
website.com/john/doe/index.html I need to cut that to say: website.com/john/doe/ I am getting really close using sed, but I just can't get the syntax quite right. Any ideas? Thank you....
  1. #1
    Just Joined!
    Join Date
    Dec 2010
    Posts
    4

    [SOLVED] Cutting last part of URL

    website.com/john/doe/index.html

    I need to cut that to say:

    website.com/john/doe/

    I am getting really close using sed, but I just can't get the syntax quite right.

    Any ideas?

    Thank you.

  2. #2
    Linux User Manko10's Avatar
    Join Date
    Sep 2010
    Posts
    250
    Hi, try that:
    Code:
    echo 'website.com/john/doe/index.html' | sed -e 's/[^\/]*$//'

  3. #3
    Just Joined!
    Join Date
    Dec 2010
    Posts
    4
    Ah yes! Thank you! I was pretty close, but didnt think of doing it your way.

Posting Permissions

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