I'm trying to find all C# interfaces from a given directory. I tried doing this command:
find . -type f | xargs basename | grep ^I
but basename
is giving back an error since I'm sending it a list of strings, not a string itself. How do I get the output of basename
executed over all the strings piped to it?
You don't need to use
xargs
for this. You can use:If you are using GNU find, you don't need
basename
either:Here,
%f
is the GNU find printf format for "filename with all but the last component removed". There are many other possible format codes; seeman find
for details.