[Techtalk] cut command, print just last field
Jean-Daniel Pauget
jd at disjunkt.com
Thu Nov 20 12:16:04 UTC 2008
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
--
Jean-Daniel Pauget
Tél: +33 (0)9 61 57 94 29 / +33 (0)2 99 73 81 89
2, rue André PELCA
50580 Denneville-Plage
France
More information about the Techtalk
mailing list