Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!samsung!uunet!zephyr.ens.tek.com!tektronix!nosun!tessi!onion!jeff From: jeff@onion.pdx.com (Jeff Beadles) Newsgroups: comp.unix.questions Subject: Re: Working with sed Message-ID: <1990Aug15.230944.2782@onion.pdx.com> Date: 15 Aug 90 23:09:44 GMT References: <994@netmbx.UUCP> <13513@smoke.BRL.MIL> <27372@unix.cis.pitt.edu> Reply-To: jeff@onion.pdx.com Organization: Little to none Lines: 21 nr3m@unix.cis.pitt.edu (Matthew A Henry) writes: |>I'm writing a script that uses sed, and am having trouble with one |>part. I have a file that contains typical unix paths, one per |>line, and would like to remove everything after the last forward |>slash (/). In other words I would like the string: |> /aaa/bbb/ccc/ddd/eee |>to be changed to: |> /aaa/bbb/ccc/ddd Of course it is. (You can do 'most anything with sed :-) Run the file thru this: sed 's:/[^/][^/]*$::' < file1 > file2 Have fun! -Jeff -- Jeff Beadles jeff@onion.pdx.com