View Full Version : ls -sl - returning specific names in path...

01 January 2008, 02:09 PM
Hi All,

When I ls -sl, I am currently getting this...


I need this...


So just the end of the hierarchy, how do I do this?

Many thanks for any help

01 January 2008, 02:16 PM
what about: ls -sl -sn ?

01 January 2008, 07:50 PM

`ls -sl -sn` will return short name in a array without pipes only if there is no other node with the same short name within the dag... instead, if you only need the last name for some reason, you can write a function which returns the short name:

global proc string getExactNodeName(string $node)

if(! `objExists $node`) return ""; // error if needed...
string $nodeName[] = stringToStringArray($node, "|");
return $nodeName[size($nodeName)-1];
// or you can tokenize and return the last token too...

example: getExactNodeName("|group5|group4|group3|group2|group1|pSphere1") will return pSphere1. There is no direct way to my knowledge to get a node's exact name if there is a duplicate node !

CGTalk Moderation
01 January 2008, 07:51 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.