this also works

Story: Four ways to extract the current directory nameTotal Replies: 0
Author Content
moopst

Nov 06, 2007
6:49 PM EDT
Rather than using the rev thing you can use $NF, the awk number of fields built in. Although I'll confess to using rev as a way to sort my .com's and yahoo.com's and my.yahoo.com's in a reasonable way.

holderm@harpo:~/frodoconf/toshiba$ pwd | awk -F / '{print $NF}' toshiba

Posting in this forum is limited to members of the group: [ForumMods, SITEADMINS, MEMBERS.]

Becoming a member of LXer is easy and free. Join Us!