[Techtalk] cut command, print just last field

Sabina Serbu sabina.serbu at unine.ch
Thu Nov 20 13:26:58 UTC 2008


Thanks for the tip!
Sabina



On Thu, 2008-11-20 at 13:16 +0100, Jean-Daniel Pauget wrote:
> On Wed, Nov 19, 2008 at 11:23:48AM +0100, Sabina Serbu wrote:
> > 
> > Hi,
> > 
> > I'm trying to get the local directory (without the absolute path) on my
> > shell.
> > 
> > For the moment, I am using awk:
> > 
> >   pwd | awk -F'/' '{print $NF}'
> > .../...
>     I have been fond of "rev" for a long time :
> 
>     pwd | rev | cut -d/ -f1 | rev
> 
-- 
Sabina Serbu
 Institut d'informatique
 Université de Neuchâtel
 +41 32 718 2724
 http://members.unine.ch/sabina.serbu



More information about the Techtalk mailing list