title: How can I extract the last X folders from the path in k shell
body: <p>Say I have a path name <code>/server/user/folderA/folderB/folderC</code>, how would I extract (to a variable) just the last few folders? I'm looking for something that will be flexible enough to give me <code>folderC</code>, or <code>folderB/folderC</code>, or <code>folderA/folderB/folderC</code>, etc. </p>
  
  <p>I'm trying to use sed, but I'm not sure that's the best approach.</p>
  
  <p>This would have to be in either ksh or csh (no bash on our machines, sadly)</p>