extract filename from path in csh shell -- from list of files

csh, linux, shell

Solution

The standard program `basename` does what you want:

$ basename /dfgfd/dfgdfg/filename
filename

Problem

How to extract filename from the path; i have a list of files. I'm using csh shell, and have awk, sed, perl installed. /dfgfd/dfgdfg/filename should give me filename I tried basename: ``` find $PROJDIR -name '*.c' -o -name '*.cc' -o -name '*.h' | xargs grep -l pattern | xargs basename ``` and it gave me the following error: basename: too few arguments Try `basename --help' for more information. thx

Original source