Wanted: How to strip off pathnames to obtain filenames.
Michael Morrell
morrell at hpsal2.HP.COM
Sat Sep 3 01:03:52 AEST 1988
/ hpsal2:comp.unix.questions / pcl at ihlpf.ATT.COM (pcl) / 4:07 pm Sep 1, 1988 /
My question is, given a full or partial pathname, how to obtain the
last field (which is the filename) in a straight foward manner.
P. C. Liu pcl at ihlpf.ATT.COM
----------
You could use "echo $filename | sed 's/.*\///'", but using basename(1) is
much easier.
Michael
More information about the Comp.unix.questions
mailing list