> > Regarding the original query, why not just use awk? Or just use basename with a little xargs added. This seems very readable and obvious to me.
echo /home/me/foo | xargs -l basename foo And then zero terminated strings are already supported. printf "/home/me/foo\0" | xargs -0 -l basename When doing the filter trick, you'd end up forking three new processes each time. Which can cause quite a serious slow down in some scripts. > You have touched a nerve... :-) From the top of my head: > > cat -- sed ':' > tac -- sed '1!G;h;$!d' > grep -- sed 'PATTERN/!d' > head -- sed '10q' > tail -- sed -e ':a' -e '$q;N;11,$D;ba' > dirname -- sed 's;[^/]*$;;' > basename -- sed 's;.*/;;' > cp OLD NEW -- sed 'w NEW' OLD > > One can always just use something else, but most often the something > else is painful. When trying to construct a filter are any of those alternatives really that painful? The basename one in particular seems quite intuitive to me. IMHO, yes, they are. Specially if you have to do it a couple times in different scripts. But not so painful that I will submit a patch for basename. :-) _______________________________________________ Bug-coreutils mailing list Bug-coreutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-coreutils