|
Guest
|
I wonder, is there an existing module to do filename (path)
stripping, like it is implemented in, e. g., patch(1)?
STRIP (0, "/a/b/c/d") => "/a/b/c/d" ;
STRIP (1, "/a/b/c/d") => "a/b/c/d" ;
STRIP (2, "/a/b/c/d") => "b/c/d" ;
STRIP (3, "/a/b/c/d") => "c/d" ;
STRIP (4, "/a/b/c/d") => "d" ;
STRIP (5, "/a/b/c/d") => "d" ;
And if there's no such module, would there be any specific
advices on how to write such a code and on how to wrap it into a
module?
PS. Even better if it would do it the other way around, too, like:
STRIP (-1, "/a/b/c/d") => "d" ;
STRIP (-2, "/a/b/c/d") => "c/d" ;
STRIP (-3, "/a/b/c/d") => "b/c/d" ;
STRIP (-4, "/a/b/c/d") => "a/b/c/d" ;
STRIP (-5, "/a/b/c/d") => "/a/b/c/d" ;
STRIP (-6, "/a/b/c/d") => "/a/b/c/d" ;
--
FSF associate member #7257 |
|
|