[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: sed expression problem ?

David selby wrote:
I am starting to use sed but am having a problem with one expression in ...

cat /mnt/archive/fluxbox/keys | sed 's/:ExecCommand//g ;s/^Mod4 \(.\) Mod
4 \(.\)/WinKey \1\2/g'

works except I hoped s/\/[^ ]+\///g would match any /path/to/file/ and delete it. It refuses to match.

Idealy ...
/usr/local/mozilla/mozilla -edit -splash

would become
mozilla -edit -splash

s/\/[^ ]\+\///g seems to work though I personally would prefer
s$/[^ ]*/$$g or s$/[^ ]\+/$$g.  I think it looks cleaner to use a
delimiter that isn't in the pattern.

Attachment: pgpvIzTaloWfm.pgp
Description: PGP signature

Reply to: