How do I extract the last directory of a pwd output? I don\'t want to use any knowledge of how many levels there are in the directory structure. If I wanted to use that, I c
Are you looking for basename or dirname?
Something like
basename "`pwd`"
should be what you want to know.
If you insist on using sed, you could also use
sed
pwd | sed 's#.*/##'